Skip to content

Commit

Permalink
Merge pull request #1964 from SciPhi-AI/feature/allow-backwards-compat
Browse files Browse the repository at this point in the history
Feature/allow backwards compat
  • Loading branch information
emrgnt-cmplxty authored Feb 11, 2025
2 parents dc6f0d4 + 22adf3c commit af648a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions py/core/main/services/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ async def rag(
search_results=aggregated_results,
citations=mapped_citations,
metadata=metadata,
completion=re_labeled_text,
)
return rag_response

Expand Down
22 changes: 8 additions & 14 deletions py/shared/api/models/retrieval/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class Config:


class RAGResponse(BaseModel):
generated_answer: str = Field(
..., description="The generated completion from the RAG process"
)
# generated_answer: str = Field(
# ..., description="The generated completion from the RAG process"
# )
search_results: AggregateSearchResult = Field(
..., description="The search results used for the RAG process"
)
Expand All @@ -121,17 +121,11 @@ class RAGResponse(BaseModel):
default_factory=dict,
description="Additional data returned by the LLM provider",
)

# Provide a deprecated alias property.
@property
@deprecated(version="3.4.1", reason="Use 'generated_answer' instead")
def completion(self) -> str:
return self.generated_answer

@completion.setter
@deprecated(version="3.4.1", reason="Use 'generated_answer' instead")
def completion(self, value: str):
self.generated_answer = value
completion: str = Field(
...,
description="The generated completion from the RAG process",
deprecated=True,
)

class Config:
json_schema_extra = {
Expand Down

0 comments on commit af648a5

Please sign in to comment.