From 3d41252153b4838dbeaad645776d4748a8b116f5 Mon Sep 17 00:00:00 2001 From: VIVEK PATEL Date: Wed, 20 Nov 2024 02:53:04 -0500 Subject: [PATCH 1/2] Added community providers --- README.md | 2 +- .../06-mixedbread-ai.mdx | 95 ++++++++++++++++++ .../03-community-providers/07.voyage-ai.mdx | 97 +++++++++++++++++++ 3 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 content/providers/03-community-providers/06-mixedbread-ai.mdx create mode 100644 content/providers/03-community-providers/07.voyage-ai.mdx diff --git a/README.md b/README.md index f90be20a312e..ad93ed3ce3ec 120000 --- a/README.md +++ b/README.md @@ -1 +1 @@ -packages/ai/README.md \ No newline at end of file +packages/ai/README.md diff --git a/content/providers/03-community-providers/06-mixedbread-ai.mdx b/content/providers/03-community-providers/06-mixedbread-ai.mdx new file mode 100644 index 000000000000..d0ff61dfc00f --- /dev/null +++ b/content/providers/03-community-providers/06-mixedbread-ai.mdx @@ -0,0 +1,95 @@ +--- +title: Mixedbread AI Provider +description: Learn how to use the Mixedbread AI provider. +--- + +# Mixedbread AI Provider + +[patelvivekdev/mixedbread-ai-provider](https://github.com/patelvivekdev/mixedbread-ai-provider) is a community provider that uses [Mixedbread](https://www.mixedbread.ai/) to provide Embedding support for the AI SDK. + +## Setup + +The Ollama provider is available in the `mixedbread-ai-provider` module. You can install it with + + + + + + + + + + + + + +## Provider Instance + +You can import the default provider instance `mixedbread ` from `mixedbread-ai-provider`: + +```ts +import { mixedbread } from 'mixedbread-ai-provider'; +``` + +If you need a customized setup, you can import `createMixedbread` from `mixedbread-ai-provider` and create a provider instance with your settings: + +```ts +import { createMixedbread } from 'mixedbread-ai-provider'; + +const mixedbread = createMixedbread({ + baseURL: 'https://api.mixedbread.ai/v1', + apiKey: process.env.MIXEDBREAD_API_KEY, +}); +``` + +You can use the following optional settings to customize the Ollama provider instance: + +- **baseURL** _string_ + + The base URL of the Mixedbread API + +- **headers** _Record<string,string>_ + + Custom headers to include in the requests. + +## Embedding Models + +You can create models that call the [Mixedbread embeddings API](https://www.mixedbread.ai/api-reference/endpoints/embeddings) +using the `.embedding()` factory method. + +```ts +import { mixedbread } from 'mixedbread-ai-provider'; + +const embeddingModel = mixedbread.textEmbeddingModel( + 'mixedbread-ai/mxbai-embed-large-v1', +); +``` + +### Model Capabilities + +| Model | Default Dimensions | Context Length | Custom Dimensions | +| --------------------------------- | ------------------ | -------------- | ------------------- | +| `mxbai-embed-large-v1` | 1024 | 512 | | +| `deepset-mxbai-embed-de-large-v1` | 1024 | 512 | | + + + The table above lists popular models. Please see the [Mixedbread + docs](https://www.mixedbread.ai/docs/embeddings/models) for a full list of + available models. + + +### Add settings to the model + +The settings object should contain the settings you want to add to the model. + +```ts +import { mixedbread } from 'mixedbread-ai-provider'; + +const embeddingModel = mixedbread.textEmbeddingModel( + 'mixedbread-ai/mxbai-embed-large-v1', + { + prompt: 'Generate embeddings for text', // Max 256 characters + dimensions: 512, // Max 1024 + }, +); +``` diff --git a/content/providers/03-community-providers/07.voyage-ai.mdx b/content/providers/03-community-providers/07.voyage-ai.mdx new file mode 100644 index 000000000000..7dd102657050 --- /dev/null +++ b/content/providers/03-community-providers/07.voyage-ai.mdx @@ -0,0 +1,97 @@ +--- +title: Voyage AI Provider +description: Learn how to use the Voyage AI provider. +--- + +# Voyage AI Provider + +[patelvivekdev/voyage-ai-provider](https://github.com/patelvivekdev/voyageai-ai-provider) is a community provider that uses [Voyage AI](https://www.voyageai.com) to provide Embedding support for the AI SDK. + +## Setup + +The Ollama provider is available in the `voyage-ai-provider` module. You can install it with + + + + + + + + + + + + + +## Provider Instance + +You can import the default provider instance `voyage ` from `voyage-ai-provider`: + +```ts +import { voyage } from 'voyage-ai-provider'; +``` + +If you need a customized setup, you can import `createVoyage` from `voyage-ai-provider` and create a provider instance with your settings: + +```ts +import { createVoyage } from 'voyage-ai-provider'; + +const voyage = createVoyage({ + baseURL: 'https://api.voyageai.com/v1', + apiKey: process.env.VOYAGE_API_KEY, +}); +``` + +You can use the following optional settings to customize the Ollama provider instance: + +- **baseURL** _string_ + + The base URL of the voyage API + +- **headers** _Record<string,string>_ + + Custom headers to include in the requests. + +## Embedding Models + +You can create models that call the [Voyage embeddings API](https://docs.voyageai.com/reference/embeddings-api) +using the `.embedding()` factory method. + +```ts +import { voyage } from 'voyage-ai-provider'; + +const embeddingModel = voyage.textEmbeddingModel('voyage-3'); +``` + +You can find more models on the [Ollama Library](https://ollama.com/library) homepage. + +### Model Capabilities + +| Model | Default Dimensions | Context Length | +| ----------------------- | ------------------ | -------------- | +| `voyage-3` | 1024 | 32000 | +| `voyage-3-lite` | 512 | 32000 | +| `voyage-finance-2` | 1024 | 32000 | +| `voyage-multilingual-2` | 1024 | 32000 | +| `voyage-law-2` | 1024 | 32000 | +| `voyage-code-2` | 1024 | 16000 | +| `voyage-3-lite` | 1024 | 16000 | + + + The table above lists popular models. Please see the [Voyage + docs](https://docs.voyageai.com/docs/embeddings) for a full list of available + models. + + +### Add settings to the model + +The settings object should contain the settings you want to add to the model. + +```ts +import { voyage } from 'voyage-ai-provider'; + +const embeddingModel = voyage.textEmbeddingModel('voyage-3', { + inputType: 'document', // 'document' or 'query' + truncation: false, +}); +``` From fdb631aabc4af2ba531066435d06c915d284b579 Mon Sep 17 00:00:00 2001 From: VIVEK PATEL Date: Thu, 21 Nov 2024 12:16:40 -0500 Subject: [PATCH 2/2] Fix: typo in mixedbread and voyage provider. --- .../providers/03-community-providers/06-mixedbread-ai.mdx | 6 +++--- content/providers/03-community-providers/07.voyage-ai.mdx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/content/providers/03-community-providers/06-mixedbread-ai.mdx b/content/providers/03-community-providers/06-mixedbread-ai.mdx index d0ff61dfc00f..49254e6e99a4 100644 --- a/content/providers/03-community-providers/06-mixedbread-ai.mdx +++ b/content/providers/03-community-providers/06-mixedbread-ai.mdx @@ -9,7 +9,7 @@ description: Learn how to use the Mixedbread AI provider. ## Setup -The Ollama provider is available in the `mixedbread-ai-provider` module. You can install it with +The Mixedbread provider is available in the `mixedbread-ai-provider` module. You can install it with @@ -42,7 +42,7 @@ const mixedbread = createMixedbread({ }); ``` -You can use the following optional settings to customize the Ollama provider instance: +You can use the following optional settings to customize the Mixedbread provider instance: - **baseURL** _string_ @@ -89,7 +89,7 @@ const embeddingModel = mixedbread.textEmbeddingModel( 'mixedbread-ai/mxbai-embed-large-v1', { prompt: 'Generate embeddings for text', // Max 256 characters - dimensions: 512, // Max 1024 + dimensions: 512, // Max 1024 for embed-large-v1 }, ); ``` diff --git a/content/providers/03-community-providers/07.voyage-ai.mdx b/content/providers/03-community-providers/07.voyage-ai.mdx index 7dd102657050..cb0d1275e7f2 100644 --- a/content/providers/03-community-providers/07.voyage-ai.mdx +++ b/content/providers/03-community-providers/07.voyage-ai.mdx @@ -9,7 +9,7 @@ description: Learn how to use the Voyage AI provider. ## Setup -The Ollama provider is available in the `voyage-ai-provider` module. You can install it with +The Voyage provider is available in the `voyage-ai-provider` module. You can install it with @@ -42,7 +42,7 @@ const voyage = createVoyage({ }); ``` -You can use the following optional settings to customize the Ollama provider instance: +You can use the following optional settings to customize the Voyage provider instance: - **baseURL** _string_ @@ -63,7 +63,7 @@ import { voyage } from 'voyage-ai-provider'; const embeddingModel = voyage.textEmbeddingModel('voyage-3'); ``` -You can find more models on the [Ollama Library](https://ollama.com/library) homepage. +You can find more models on the [Voyage Library](https://docs.voyageai.com/docs/embeddings) homepage. ### Model Capabilities