LangChain Apache Doris Settings for Vector Storage
Posted: Nov 7, 2024.
Apache Doris is a powerful data warehouse that can be used as a vector store in LangChain applications. Let's explore how to configure it properly using the ApacheDorisSettings class.
What is ApacheDorisSettings?
ApacheDorisSettings is a configuration class that allows you to set up connection and table details for using Apache Doris as a vector store in LangChain. It handles everything from basic connection parameters like host and port to specific table configurations for storing embeddings and metadata.
Reference
Here are the key configuration parameters available in ApacheDorisSettings:
Parameter | Description | Default Value |
---|---|---|
apache_doris_host | Host URL for the Doris frontend | 'localhost' |
apache_doris_port | HTTP port for connection | 9030 |
username | Login username | 'root' |
password | Login password | None |
database | Database name | 'default' |
table | Table name for operations | 'langchain' |
column_map | Dictionary mapping column names | Default identity map |
How to Use ApacheDorisSettings
Basic Configuration
Here's a simple example of creating a basic ApacheDorisSettings instance:
Custom Column Mapping
You can customize how your data is mapped to Doris columns using the column_map parameter:
This mapping tells Doris to use custom column names instead of the default ones.
Using with Vector Store
Here's how to use ApacheDorisSettings with the Apache Doris vector store:
Environment-based Configuration
You can also use environment variables to configure ApacheDorisSettings. The class will automatically look for these variables:
Then in your code:
Using ApacheDorisSettings properly ensures your vector store operations with Apache Doris are configured correctly and efficiently. Remember to always secure your credentials and consider using environment variables for sensitive information in production environments.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.
LangChain DocsJoin 10,000+ subscribers
Every 2 weeks, latest model releases and industry news.
An alternative to LangSmith
Open-source LangChain monitoring, prompt management, and magic. Get started in 2 minutes.