Skip to content

Commit

Permalink
Set pgvector.dimension to 384
Browse files Browse the repository at this point in the history
  • Loading branch information
mawandm committed Apr 4, 2024
1 parent dd6147f commit 2f38b5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ services:
# 2. sagemaker - for Sagemaker
NESIS_RAG_EMBEDDING_MODE: local
OPENAI_API_KEY: <your-api-key>
NESIS_RAG_EMBEDDING_DIMENSIONS: "1536"
# OPENAI_API_BASE: <your-api-base>
networks:
- nesis
Expand Down
6 changes: 4 additions & 2 deletions nesis/rag/core/server/ingest/ingest_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ def ingest_file(
_metadata_str = request.query_params.get("metadata") or str(metadata)
_metadata = json.loads(_metadata_str)
except ValueError:
raise HTTPException(400, "Invalid of missing metadata field")
error = "Invalid of missing metadata field"
_logger.exception(error)
raise HTTPException(400, error)
try:
ingested_documents = service.ingest_bin_data(
file.filename, file.file, metadata=_metadata
)
except ServiceException as se:
_logger.exception(f"Error injesting file {_metadata['file_name']}")
_logger.exception(f"Error ingesting file {file.filename}")
raise HTTPException(400, str(se))
return IngestResponse(object="list", model="private-gpt", data=ingested_documents)

Expand Down
3 changes: 1 addition & 2 deletions nesis/rag/settings-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ vectorstore:
pgvector:
url: ${NESIS_RAG_PGVECTOR_URL:postgresql://postgres:password@localhost:65432/nesis}
table: embeddings
dimensions: 384 #pg_vector dimensions
# dimensions: 1536 #openai dimensions
dimensions: 384 #openai dimensions

local:
prompt_style: "llama2"
Expand Down

0 comments on commit 2f38b5d

Please sign in to comment.