Skip to content

Commit

Permalink
fix small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
elisalimli committed Mar 7, 2024
1 parent 1dbff76 commit 585a5c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion service/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ async def get_documents(
if not len(chunks):
logger.error(f"No documents found for query: {payload.input}")
return []
is_structured = chunks[0].metadata.get("filetype") in STRUCTURED_DATA
is_structured = (
chunks[0].metadata and chunks[0].metadata.get("filetype") in STRUCTURED_DATA
)
reranked_chunks = []
if is_structured and payload.interpreter_mode:
async with CodeInterpreterService(
Expand Down
4 changes: 2 additions & 2 deletions vectordbs/weaviate.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def query(self, input: str, top_k: int = 25) -> list[BaseDocumentChunk]:
try:
response = (
self.client.query.get(
class_name=self.index_name.capitalize(),
class_name=self.index_name,
properties=["document_id", "text", "doc_url", "page_number"],
)
.with_near_vector(vector)
Expand All @@ -88,7 +88,7 @@ async def query(self, input: str, top_k: int = 25) -> list[BaseDocumentChunk]:
logger.error(f"Missing 'data' in response: {response}")
return []

result_data = response["data"]["Get"][self.index_name.capitalize()]
result_data = response["data"]["Get"][self.index_name]
document_chunks = []
for result in result_data:
document_chunk = BaseDocumentChunk(
Expand Down

0 comments on commit 585a5c2

Please sign in to comment.