vector_store
AddDocumentInput
Bases: BaseModel
Add Document Input
Attributes:
| Name | Type | Description |
|---|---|---|
content | str | Document content |
collection_name | str | Collection name |
reference_id | str | Reference ID |
Source code in api/routes/vector_store.py
AddDocumentResponse
Bases: BaseModel
Add Document Response
Attributes:
| Name | Type | Description |
|---|---|---|
ids | list[str] | List of unique document IDs |
Source code in api/routes/vector_store.py
DocumentWithReference
SimilaritySearchResponse
Bases: BaseModel
Similarity Search Response
Attributes:
| Name | Type | Description |
|---|---|---|
documents | list[DocumentWithReference] | List of documents |
Source code in api/routes/vector_store.py
create_document(document, chroma_client, cohere_embeddings)
Add a document to the vector store
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document | AddDocumentInput | Add Document Input | required |
chroma_client | Client | Chroma client | required |
cohere_embeddings | Embeddings | Embeddings function | required |
Returns:
| Name | Type | Description |
|---|---|---|
AddDocumentResponse | Annotated[AddDocumentResponse, 'Document added'] | Document added |
Source code in api/routes/vector_store.py
delete_documents_by_reference_id(reference_id, collection_name, chroma_client)
Delete documents by reference ID
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_id | str | Reference ID | required |
collection_name | str | Collection name | required |
chroma_client | Client | Chroma client | required |
Returns:
| Name | Type | Description |
|---|---|---|
None | Annotated[None, 'No content'] | No content |
Source code in api/routes/vector_store.py
similarity_search(collection_name, chroma_client, cohere_embeddings, query, k=10, reference_id=None, reference_callback=None)
Search for similar documents
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collection_name | str | Collection name | required |
chroma_client | Client | Chroma client | required |
cohere_embeddings | CohereEmbeddingsFunction | Embeddings function | required |
query | str | Query string | required |
k | int | Number of documents to return | 10 |
reference_id | str | Reference ID | None |
reference_callback | str | Reference callback url | None |
Returns:
| Name | Type | Description |
|---|---|---|
SimilaritySearchResponse | Annotated[SimilaritySearchResponse, 'Similarity Search Response'] | Similarity Search Response |
Source code in api/routes/vector_store.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |