mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
Fix flexible dimension and doc for DingoDB (#12187)
This commit is contained in:
parent
95ae40ff90
commit
d76f026d72
File diff suppressed because one or more lines are too long
@ -1,14 +1,14 @@
|
|||||||
# Dingo
|
# DingoDB
|
||||||
|
|
||||||
This page covers how to use the Dingo ecosystem within LangChain.
|
This page covers how to use the DingoDB ecosystem within LangChain.
|
||||||
It is broken into two parts: installation and setup, and then references to specific Dingo wrappers.
|
It is broken into two parts: installation and setup, and then references to specific DingoDB wrappers.
|
||||||
|
|
||||||
## Installation and Setup
|
## Installation and Setup
|
||||||
- Install the Python SDK with `pip install dingodb`
|
- Install the Python SDK with `pip install dingodb`
|
||||||
|
|
||||||
## VectorStore
|
## VectorStore
|
||||||
|
|
||||||
There exists a wrapper around Dingo indexes, allowing you to use it as a vectorstore,
|
There exists a wrapper around DingoDB indexes, allowing you to use it as a vectorstore,
|
||||||
whether for semantic search or example selection.
|
whether for semantic search or example selection.
|
||||||
|
|
||||||
To import this vectorstore:
|
To import this vectorstore:
|
||||||
@ -16,4 +16,4 @@ To import this vectorstore:
|
|||||||
from langchain.vectorstores import Dingo
|
from langchain.vectorstores import Dingo
|
||||||
```
|
```
|
||||||
|
|
||||||
For a more detailed walkthrough of the Dingo wrapper, see [this notebook](/docs/integrations/vectorstores/dingo.html)
|
For a more detailed walkthrough of the DingoDB wrapper, see [this notebook](/docs/integrations/vectorstores/dingo.html)
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
"id": "683953b3",
|
"id": "683953b3",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"# Dingo\n",
|
"# DingoDB\n",
|
||||||
"\n",
|
"\n",
|
||||||
">[Dingo](https://dingodb.readthedocs.io/en/latest/) is a distributed multi-mode vector database, which combines the characteristics of data lakes and vector databases, and can store data of any type and size (Key-Value, PDF, audio, video, etc.). It has real-time low-latency processing capabilities to achieve rapid insight and response, and can efficiently conduct instant analysis and process multi-modal data.\n",
|
">[DingoDB](https://dingodb.readthedocs.io/en/latest/) is a distributed multi-mode vector database, which combines the characteristics of data lakes and vector databases, and can store data of any type and size (Key-Value, PDF, audio, video, etc.). It has real-time low-latency processing capabilities to achieve rapid insight and response, and can efficiently conduct instant analysis and process multi-modal data.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This notebook shows how to use functionality related to the DingoDB vector database.\n",
|
"This notebook shows how to use functionality related to the DingoDB vector database.\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -36,6 +36,7 @@ class Dingo(VectorStore):
|
|||||||
*,
|
*,
|
||||||
client: Any = None,
|
client: Any = None,
|
||||||
index_name: Optional[str] = None,
|
index_name: Optional[str] = None,
|
||||||
|
dimension: int = 1024,
|
||||||
host: Optional[List[str]] = None,
|
host: Optional[List[str]] = None,
|
||||||
user: str = "root",
|
user: str = "root",
|
||||||
password: str = "123123",
|
password: str = "123123",
|
||||||
@ -67,9 +68,11 @@ class Dingo(VectorStore):
|
|||||||
|
|
||||||
if index_name is not None and index_name not in dingo_client.get_index():
|
if index_name is not None and index_name not in dingo_client.get_index():
|
||||||
if self_id is True:
|
if self_id is True:
|
||||||
dingo_client.create_index(index_name, 1024, auto_id=False)
|
dingo_client.create_index(
|
||||||
|
index_name, dimension=dimension, auto_id=False
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
dingo_client.create_index(index_name, 1024)
|
dingo_client.create_index(index_name, dimension=dimension)
|
||||||
|
|
||||||
self._index_name = index_name
|
self._index_name = index_name
|
||||||
self._embedding = embedding
|
self._embedding = embedding
|
||||||
@ -268,6 +271,7 @@ class Dingo(VectorStore):
|
|||||||
ids: Optional[List[str]] = None,
|
ids: Optional[List[str]] = None,
|
||||||
text_key: str = "text",
|
text_key: str = "text",
|
||||||
index_name: Optional[str] = None,
|
index_name: Optional[str] = None,
|
||||||
|
dimension: int = 1024,
|
||||||
client: Any = None,
|
client: Any = None,
|
||||||
host: List[str] = ["172.20.31.10:13000"],
|
host: List[str] = ["172.20.31.10:13000"],
|
||||||
user: str = "root",
|
user: str = "root",
|
||||||
@ -315,11 +319,12 @@ class Dingo(VectorStore):
|
|||||||
raise ValueError(f"Dingo failed to connect: {e}")
|
raise ValueError(f"Dingo failed to connect: {e}")
|
||||||
if kwargs is not None and kwargs.get("self_id") is True:
|
if kwargs is not None and kwargs.get("self_id") is True:
|
||||||
if index_name not in dingo_client.get_index():
|
if index_name not in dingo_client.get_index():
|
||||||
dingo_client.create_index(index_name, 1024, auto_id=False)
|
dingo_client.create_index(
|
||||||
|
index_name, dimension=dimension, auto_id=False
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if index_name not in dingo_client.get_index():
|
if index_name not in dingo_client.get_index():
|
||||||
dingo_client.create_index(index_name, 1024)
|
dingo_client.create_index(index_name, dimension=dimension)
|
||||||
# dingo_client.create_index(index_name, 1024, index_type="hnsw")
|
|
||||||
|
|
||||||
# Embed and create the documents
|
# Embed and create the documents
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user