michaelfeil
commited on
Commit
·
b958639
1
Parent(s):
2624c54
push demo again
Browse files- Dockerfile +1 -1
- search.py +4 -4
Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from python:3.10-slim
|
2 |
|
3 |
-
RUN pip install groq gradio infinity_emb[all] usearch
|
4 |
|
5 |
WORKDIR /app
|
6 |
COPY . .
|
|
|
1 |
from python:3.10-slim
|
2 |
|
3 |
+
RUN pip install groq gradio infinity_emb[all] usearch datasets
|
4 |
|
5 |
WORKDIR /app
|
6 |
COPY . .
|
search.py
CHANGED
@@ -43,10 +43,10 @@ def build_index(demo_mode=True):
|
|
43 |
)
|
44 |
if demo_mode:
|
45 |
docs_index = [
|
46 |
-
"
|
47 |
-
"
|
48 |
-
"
|
49 |
-
"torch.sub(
|
50 |
]
|
51 |
embeddings = embed_texts_sync(docs_index)
|
52 |
index.add(np.arange(len(docs_index)), embeddings)
|
|
|
43 |
)
|
44 |
if demo_mode:
|
45 |
docs_index = [
|
46 |
+
"""def HttpClient( host: str = "localhost", port: int = 8000, ssl: bool = False, headers: Optional[Dict[str, str]] = None, settings: Optional[Settings] = None, tenant: str = DEFAULT_TENANT, database: str = DEFAULT_DATABASE, ) -> ClientAPI: Creates a client that connects to a remote Chroma server. This supports many clients connecting to the same server, and is the recommended way to use Chroma in production. Args: host: The hostname of the Chroma server. Defaults to "localhost". port: The port of the Chroma server. Defaults to "8000". ssl: Whether to use SSL to connect to the Chroma server. Defaults to False. headers: A dictionary of headers to send to the Chroma server. Defaults to {}. settings: A dictionary of settings to communicate with the chroma server. tenant: The tenant to use for this client. Defaults to the default tenant. database: The database to use for this client. Defaults to the default database. if settings is None: settings = Settings() # Make sure paramaters are the correct types -- users can pass anything. host = str(host) port = int(port) ssl = bool(ssl) tenant = str(tenant) database = str(database) settings.chroma_api_impl = "chromadb.api.fastapi.FastAPI" if settings.chroma_server_host and settings.chroma_server_host != host: raise ValueError( f"Chroma server host provided in settings[{settings.chroma_server_host}] is different to the one provided in HttpClient: [{host}]" ) settings.chroma_server_host = host if settings.chroma_server_http_port and settings.chroma_server_http_port != port: raise ValueError( f"Chroma server http port provided in settings[{settings.chroma_server_http_port}] is different to the one provided in HttpClient: [{port}]" ) settings.chroma_server_http_port = port settings.chroma_server_ssl_enabled = ssl settings.chroma_server_headers = headers return ClientCreator(tenant=tenant, database=database, settings=settings) """,
|
47 |
+
"""def PersistentClient( path: str = "./chroma", settings: Optional[Settings] = None, tenant: str = DEFAULT_TENANT, database: str = DEFAULT_DATABASE, ) -> ClientAPI: Creates a persistent instance of Chroma that saves to disk. This is useful for testing and development, but not recommended for production use. Args: path: The directory to save Chroma's data to. Defaults to "./chroma". tenant: The tenant to use for this client. Defaults to the default tenant. database: The database to use for this client. Defaults to the default database. if settings is None: settings = Settings() settings.persist_directory = path settings.is_persistent = True # Make sure paramaters are the correct types -- users can pass anything. tenant = str(tenant) database = str(database) return ClientCreator(tenant=tenant, database=database, settings=settings) """,
|
48 |
+
"""class TokenTransportHeader(Enum): Accceptable token transport headers. # I don't love having this enum here -- it's weird to have an enum # for just two values and it's weird to have users pass X_CHROMA_TOKEN # to configure x-chroma-token. But I also like having a single source # of truth, so 🤷🏻♂️ AUTHORIZATION = "Authorization" X_CHROMA_TOKEN = "X-Chroma-Token""",
|
49 |
+
"torch.sub(input, other, *, alpha=1, out=None) → TensorSubtracts other, scaled by alpha, from input.outi=inputi−alpha×otheriouti=inputi−alpha×otheriSupports broadcasting to a common shape, type promotion, and integer, float, and complex inputs.Parametersinput (Tensor) – the input tensor.other (Tensor or Number) – the tensor or number to subtract from input.Keyword Argumentsalpha (Number) – the multiplier for other.out (Tensor, optional) – the output tensor.",
|
50 |
]
|
51 |
embeddings = embed_texts_sync(docs_index)
|
52 |
index.add(np.arange(len(docs_index)), embeddings)
|