fixed hardcoded embeddingDims (#3537)

This commit is contained in:
Mrinank Bhowmick
2025-10-09 23:39:20 +05:30
committed by GitHub
parent 9000576173
commit 64571002f5
11 changed files with 85 additions and 29 deletions
@@ -117,9 +117,20 @@ Refer to [Azure Identity troubleshooting tips](https://github.com/Azure/azure-sd
### Config
Here are the parameters available for configuring Azure OpenAI embedder:
<Tabs>
<Tab title="Python">
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `azure_kwargs` | The Azure OpenAI configs | `config_keys` |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Default Value |
| ----------------- | --------------------------------------------- | -------------------------- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embeddingDims` | Dimensions of the embedding model | `1536` |
| `apiKey` | Azure OpenAI API key | `None` |
| `modelProperties` | Object containing endpoint and other settings | `{ endpoint: "",...rest }`|
</Tab>
</Tabs>
+22 -12
View File
@@ -38,13 +38,13 @@ import { Memory } from 'mem0ai/oss';
const config = {
embedder: {
provider: 'google',
config: {
apiKey: process.env.GOOGLE_API_KEY || '',
model: 'text-embedding-004',
// The output dimensionality is fixed at 768 for Google AI embeddings
provider: "google",
config: {
apiKey: process.env["GOOGLE_API_KEY"],
model: "gemini-embedding-001",
embeddingDims: 1536,
},
},
},
};
const memory = new Memory(config);
@@ -61,9 +61,19 @@ await memory.add(messages, { userId: "john" });
### Config
Here are the parameters available for configuring Gemini embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `models/text-embedding-004` |
| `embedding_dims` | Dimensions of the embedding model (output_dimensionality will be considered as embedding_dims, so please set embedding_dims accordingly) | `768` |
| `api_key` | The Google API key | `None` |
<Tabs>
<Tab title="Python">
| Parameter | Description | Default Value |
| ---------------- | ------------------------------------ | ----------------------- |
| `model` | The name of the embedding model to use| `models/text-embedding-004` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `api_key` | The Google API key | `None` |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Default Value |
| ----------------- | --------------------------------------------- | -------------------------- |
| `model` | The name of the embedding model to use | `gemini-embedding-001` |
| `embeddingDims` | Dimensions of the embedding model | `1536` |
| `apiKey` | Google API key | `None` |
</Tab>
</Tabs>
@@ -69,5 +69,6 @@ Here are the parameters available for configuring Ollama embedder:
| --- | --- | --- |
| `model` | The name of the Ollama model to use | `nomic-embed-text:latest` |
| `url` | Base URL for Ollama server | `http://localhost:11434` |
| `embeddingDims` | Dimensions of the embedding model | 768
</Tab>
</Tabs>
@@ -23,7 +23,7 @@ config = {
"embedder": {
"provider": "azure_openai",
"config": {
"model": "text-embedding-3-large"
"model": "text-embedding-3-large",
"azure_kwargs": {
"api_version": "",
"azure_deployment": "",
@@ -117,9 +117,20 @@ Refer to [Azure Identity troubleshooting tips](https://github.com/Azure/azure-sd
### Config
Here are the parameters available for configuring Azure OpenAI embedder:
<Tabs>
<Tab title="Python">
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `azure_kwargs` | The Azure OpenAI configs | `config_keys` |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Default Value |
| ----------------- | --------------------------------------------- | -------------------------- |
| `model` | The name of the embedding model to use | `text-embedding-3-small` |
| `embeddingDims` | Dimensions of the embedding model | `1536` |
| `apiKey` | Azure OpenAI API key | `None` |
| `modelProperties` | Object containing endpoint and other settings | `{ endpoint: "",...rest }`|
</Tab>
</Tabs>
@@ -38,13 +38,13 @@ import { Memory } from 'mem0ai/oss';
const config = {
embedder: {
provider: 'google',
config: {
apiKey: process.env.GOOGLE_API_KEY || '',
model: 'text-embedding-004',
// The output dimensionality is fixed at 768 for Google AI embeddings
provider: "google",
config: {
apiKey: process.env["GOOGLE_API_KEY"],
model: "gemini-embedding-001",
embeddingDims: 1536,
},
},
},
};
const memory = new Memory(config);
@@ -62,8 +62,19 @@ await memory.add(messages, { userId: "john" });
Here are the parameters available for configuring Gemini embedder:
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `models/text-embedding-004` |
| `embedding_dims` | Dimensions of the embedding model (output_dimensionality will be considered as embedding_dims, so please set embedding_dims accordingly) | `768` |
| `api_key` | The Google API key | `None` |
<Tabs>
<Tab title="Python">
| Parameter | Description | Default Value |
| ---------------- | ------------------------------------ | ----------------------- |
| `model` | The name of the embedding model to use| `models/text-embedding-004` |
| `embedding_dims` | Dimensions of the embedding model | `1536` |
| `api_key` | The Google API key | `None` |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Default Value |
| ----------------- | --------------------------------------------- | -------------------------- |
| `model` | The name of the embedding model to use | `gemini-embedding-001` |
| `embeddingDims` | Dimensions of the embedding model | `1536` |
| `apiKey` | Google API key | `None` |
</Tab>
</Tabs>
@@ -69,5 +69,6 @@ Here are the parameters available for configuring Ollama embedder:
| --- | --- | --- |
| `model` | The name of the Ollama model to use | `nomic-embed-text:latest` |
| `url` | Base URL for Ollama server | `http://localhost:11434` |
| `embeddingDims` | Dimensions of the embedding model | 768 |
</Tab>
</Tabs>