@chikichat/model v1.2.6
AI SDK (model) 👋
The AI SDK is a TypeScript toolkit designed to help you build AI-powered applications using popular frameworks like Next.js, React, Svelte, Vue and runtimes like Bun or Node.js.
We are based on the AI SDK.
Installation
You will need Bun or Node.js 18+ and pnpm installed on your local development machine.
pnpm i @chikichat/modelProviders
- AI21 Labs
- Anthropic
- Cohere
- DeepSeek
- Google Generative AI
- Groq
- Hugging Face
- Mistral
- Novita
- Nvidia
- OpenAI
- OpenRouter AI
- Perplexity
- Qwen
- SambaNova
- Together
- Vertex AI
- xAI
and SPECIAL
- Co:Here
- llama.cpp
- TensorRT-LLM
Usage Examples
Large language models (LLMs) can generate text in response to a prompt, which can contain instructions and information to process. For example, you can ask a model to come up with a recipe, draft an email, or summarize a document.
@/index.ts (Bun Runtime)
import {generateText} from 'ai';
import {languageModel, usageModel} from '@chikichat/model';
const model = 'anthropic/claude-3-5-sonnet-20241022';
/**
* Generate text using a language model.
*/
const {text, usage} = await generateText({
model: languageModel(model, '<api key>'),
system: 'You are a friendly assistant!',
prompt: 'Why is the sky blue?',
});
console.log(text);
console.log(usageModel(model, usage));
// read more: https://sdk.vercel.ai/docs/ai-sdk-core/generating-text bun run index.tsEmbeddings are a way to represent words, phrases, or images as vectors in a high-dimensional space. In this space, similar words are close to each other, and the distance between words can be used to measure their similarity.
@/index.ts (Bun Runtime)
import {embed} from 'ai';
import {embeddingModel} from '@chikichat/model';
/**
* Embed a text using an embedding model.
*/
const {embedding} = await embed({
model: embeddingModel('mistral/mistral-embed', '<api key>'),
value: 'sunny day at the beach',
});
console.log(embedding);
// read more: https://sdk.vercel.ai/docs/ai-sdk-core/embeddingsbun run index.tsContributing
Contributions to the AI SDK are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have smooth experience contributing to AI SDK.
License
This project is licensed under the Apache License Version 2.0 License - see the LICENSE file for details.