updating server imports
Browse files
server.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
from chromadb.config import Settings
|
2 |
import chromadb
|
3 |
-
|
4 |
-
from
|
5 |
-
from
|
6 |
from chromadb.api.types import (
|
7 |
Documents,
|
8 |
Embeddings,
|
@@ -16,6 +16,23 @@ from chromadb.api.types import (
|
|
16 |
QueryResult,
|
17 |
CollectionMetadata,
|
18 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
import chromadb.utils.embedding_functions as ef
|
20 |
import pandas as pd
|
21 |
import requests
|
@@ -26,6 +43,8 @@ import chromadb.errors as errors
|
|
26 |
from uuid import UUID
|
27 |
from chromadb.telemetry import Telemetry
|
28 |
from overrides import override
|
|
|
|
|
29 |
import time
|
30 |
|
31 |
class client():
|
@@ -48,12 +67,16 @@ class client():
|
|
48 |
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
|
49 |
get_or_create: bool = False,
|
50 |
) -> Collection:
|
51 |
-
|
|
|
|
|
52 |
|
53 |
def get_collection(
|
54 |
self,
|
55 |
name: str,
|
56 |
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
|
57 |
) -> Collection:
|
58 |
-
|
|
|
|
|
59 |
|
|
|
1 |
from chromadb.config import Settings
|
2 |
import chromadb
|
3 |
+
rom pydantic import BaseModel
|
4 |
+
from typing import List, Dict, Any, Generator, Optional, cast
|
5 |
+
from server import client
|
6 |
from chromadb.api.types import (
|
7 |
Documents,
|
8 |
Embeddings,
|
|
|
16 |
QueryResult,
|
17 |
CollectionMetadata,
|
18 |
)
|
19 |
+
from chromadb.errors import (
|
20 |
+
ChromaError,
|
21 |
+
InvalidUUIDError,
|
22 |
+
InvalidDimensionException,
|
23 |
+
)
|
24 |
+
from chromadb.server.fastapi.types import (
|
25 |
+
AddEmbedding,
|
26 |
+
DeleteEmbedding,
|
27 |
+
GetEmbedding,
|
28 |
+
QueryEmbedding,
|
29 |
+
RawSql, # Results,
|
30 |
+
CreateCollection,
|
31 |
+
UpdateCollection,
|
32 |
+
UpdateEmbedding,
|
33 |
+
)
|
34 |
+
from chromadb.api import API
|
35 |
+
from chromadb.config import System
|
36 |
import chromadb.utils.embedding_functions as ef
|
37 |
import pandas as pd
|
38 |
import requests
|
|
|
43 |
from uuid import UUID
|
44 |
from chromadb.telemetry import Telemetry
|
45 |
from overrides import override
|
46 |
+
|
47 |
+
|
48 |
import time
|
49 |
|
50 |
class client():
|
|
|
67 |
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
|
68 |
get_or_create: bool = False,
|
69 |
) -> Collection:
|
70 |
+
col=self.db.create_collection(name,metadata=metadata,embedding_function=embedding_function,get_or_create=get_or_create)
|
71 |
+
print(col)
|
72 |
+
return col
|
73 |
|
74 |
def get_collection(
|
75 |
self,
|
76 |
name: str,
|
77 |
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
|
78 |
) -> Collection:
|
79 |
+
col=self.db.get_collection(name,embedding_function=embedding_function)
|
80 |
+
print(col)
|
81 |
+
return col
|
82 |
|