Add langchain embedding, update langchain LLM and version bump -> 0.1.84 (#2510)

This commit is contained in:
Dev Khant
2025-04-07 15:27:26 +05:30
committed by GitHub
parent 5509066925
commit 9dfa9b4412
14 changed files with 266 additions and 253 deletions

View File

@@ -109,7 +109,6 @@ Here's a comprehensive list of all parameters that can be used across different
| `deepseek_base_url` | Base URL for DeepSeek API | DeepSeek |
| `xai_base_url` | Base URL for XAI API | XAI |
| `lmstudio_base_url` | Base URL for LM Studio API | LM Studio |
| `langchain_provider` | Provider for Langchain | Langchain |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Provider |

View File

@@ -12,19 +12,24 @@ For a complete list of available chat models supported by LangChain, refer to th
```python Python
import os
from mem0 import Memory
from langchain_openai import ChatOpenAI
# Set necessary environment variables for your chosen LangChain provider
# For example, if using OpenAI through LangChain:
os.environ["OPENAI_API_KEY"] = "your-api-key"
# Initialize a LangChain model directly
openai_model = ChatOpenAI(
model="gpt-4o",
temperature=0.2,
max_tokens=2000
)
# Pass the initialized model to the config
config = {
"llm": {
"provider": "langchain",
"config": {
"langchain_provider": "OpenAI",
"model": "gpt-4o",
"temperature": 0.2,
"max_tokens": 2000,
"model": openai_model
}
}
}
@@ -53,15 +58,15 @@ LangChain supports a wide range of LLM providers, including:
- HuggingFace (`HuggingFaceChatEndpoint`)
- And many more
You can specify any supported provider in the `langchain_provider` parameter. For a complete and up-to-date list of available providers, refer to the [LangChain Chat Models documentation](https://python.langchain.com/docs/integrations/chat).
You can use any of these model instances directly in your configuration. For a complete and up-to-date list of available providers, refer to the [LangChain Chat Models documentation](https://python.langchain.com/docs/integrations/chat).
## Provider-Specific Configuration
When using LangChain as a provider, you'll need to:
1. Set the appropriate environment variables for your chosen LLM provider
2. Specify the LangChain provider class name in the `langchain_provider` parameter
3. Include any additional configuration parameters required by the specific provider
2. Import and initialize the specific model class you want to use
3. Pass the initialized model instance to the config
<Note>
Make sure to install the necessary LangChain packages and any provider-specific dependencies.