Vanna.ai connect to local ChromaDB #674
Unanswered
geraldineLTC
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am new to Vanna.ai, Chromadb. i tried to follow the vanna documentation to setup a local chromadb, but struggled a while, no luck to make it work, follows is my code
from vanna.google import GoogleGeminiChat
from vanna.chromadb import ChromaDB_VectorStore
from chromadb.utils import embedding_functions
from chromadb import HttpClient
from chromadb.config import Settings
class MyVanna(ChromaDB_VectorStore, GoogleGeminiChat):
def init(self, config=None):
ChromaDB_VectorStore.init(self, config=config)
GoogleGeminiChat.init(self, config={'api_key': 'xxxxxxxxxxxx', 'model': 'gemini-1.5-flash-latest'})
chroma_client = HttpClient(host='127.0.0.1', port=8000, settings=Settings(allow_reset=True, anonymized_telemetry=False))
vn = MyVanna(config={"client":chroma_client,'path': 'C:/Containers/Chromadb/'})
vn.connect_to_mysql(host='localhost', dbname='sakila', user='root', password='root1234', port=3306)
df_information_schema = vn.run_sql("SELECT * FROM INFORMATION_SCHEMA.COLUMNS")
This will break up the information schema into bite-sized chunks that can be referenced by the LLM
plan = vn.get_training_plan_generic(df_information_schema)
However from browser I can connect to Chromdb without problem
Any idea? Many thanks in advance
======version information ===
chromadb==0.5.15
chromadb-client==0.5.13
vanna==0.7.3
python: 3.11.9
========error information =========
{
"name": "ValueError",
"message": "Could not connect to tenant default_tenant. Are you sure it exists?",
"stack": "---------------------------------------------------------------------------
HTTPStatusError Traceback (most recent call last)
File c:\vannaai\Lib\site-packages\chromadb\api\base_http_client.py:99, in BaseHTTPClient._raise_chroma_error(resp)
98 try:
---> 99 resp.raise_for_status()
100 except httpx.HTTPStatusError:
File c:\vannaai\Lib\site-packages\httpx\_models.py:763, in Response.raise_for_status(self)
762 message = message.format(self, error_type=error_type)
--> 763 raise HTTPStatusError(message, request=request, response=self)
HTTPStatusError: Server error '503 Service Unavailable' for url 'http://127.0.0.1:8000/api/v1/tenants/default_tenant'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
File c:\vannaai\Lib\site-packages\chromadb\api\client.py:371, in Client._validate_tenant_database(self, tenant, database)
370 try:
--> 371 self._admin_client.get_tenant(name=tenant)
372 except httpx.ConnectError:
File c:\vannaai\Lib\site-packages\chromadb\api\client.py:415, in AdminClient.get_tenant(self, name)
413 @OverRide
414 def get_tenant(self, name: str) -> Tenant:
--> 415 return self._server.get_tenant(name=name)
File c:\vannaai\Lib\site-packages\chromadb\telemetry\opentelemetry\init.py:146, in trace_method..decorator..wrapper(*args, **kwargs)
145 if trace_granularity < granularity:
--> 146 return f(*args, **kwargs)
147 if not tracer:
File c:\vannaai\Lib\site-packages\chromadb\api\fastapi.py:139, in FastAPI.get_tenant(self, name)
136 @trace_method("FastAPI.get_tenant", OpenTelemetryGranularity.OPERATION)
137 @OverRide
138 def get_tenant(self, name: str) -> Tenant:
--> 139 resp_json = self._make_request("get", "/tenants/" + name)
140 return Tenant(name=resp_json["name"])
File c:\vannaai\Lib\site-packages\chromadb\api\fastapi.py:89, in FastAPI._make_request(self, method, path, **kwargs)
88 response = self._session.request(method, url, **cast(Any, kwargs))
---> 89 BaseHTTPClient._raise_chroma_error(response)
90 return orjson.loads(response.text)
File c:\vannaai\Lib\site-packages\chromadb\api\base_http_client.py:104, in BaseHTTPClient._raise_chroma_error(resp)
103 raise Exception(f"{resp.text} (trace ID: {trace_id})")
--> 104 raise (Exception(resp.text))
Exception:
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
Cell In[17], line 25
22 ChromaDB_VectorStore.init(self, config=config)
23 GoogleGeminiChat.init(self, config={'api_key': 'AIzaSyAk1DYROT48XbP8_pJF76-70QFhEbjT1YY', 'model': 'gemini-1.5-flash-latest'})
---> 25 chroma_client = HttpClient(host='127.0.0.1', port=8000, settings=Settings(allow_reset=True, anonymized_telemetry=False))
26 vn = MyVanna(config={"client":chroma_client,'path': 'C:/Containers/Chromadb/'})
28 vn.connect_to_mysql(host='localhost', dbname='sakila', user='root', password='root1234', port=3306)
File c:\vannaai\Lib\site-packages\chromadb\init.py:204, in HttpClient(host, port, ssl, headers, settings, tenant, database)
201 settings.chroma_server_ssl_enabled = ssl
202 settings.chroma_server_headers = headers
--> 204 return ClientCreator(tenant=tenant, database=database, settings=settings)
File c:\vannaai\Lib\site-packages\chromadb\api\client.py:61, in Client.init(self, tenant, database, settings)
59 # Create an admin client for verifying that databases and tenants exist
60 self._admin_client = AdminClient.from_system(self._system)
---> 61 self._validate_tenant_database(tenant=tenant, database=database)
63 # Get the root system component we want to interact with
64 self._server = self._system.instance(ServerAPI)
File c:\vannaai\Lib\site-packages\chromadb\api\client.py:380, in Client._validate_tenant_database(self, tenant, database)
378 raise e
379 except Exception:
--> 380 raise ValueError(
381 f"Could not connect to tenant {tenant}. Are you sure it exists?"
382 )
384 try:
385 self._admin_client.get_database(name=database, tenant=tenant)
ValueError: Could not connect to tenant default_tenant. Are you sure it exists?"
}
Beta Was this translation helpful? Give feedback.
All reactions