Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/app/endpoints/query_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,16 @@ def parse_referenced_documents_from_responses_api(
final_url = doc_url if doc_url else None
if (final_url, filename) not in seen_docs:
documents.append(
ReferencedDocument(doc_url=final_url, doc_title=filename)
ReferencedDocument(
doc_url=final_url,
doc_title=filename,
document_id=None,
product_name=None,
product_version=None,
source_path=None,
score=None,
chunk_metadata=None,
)
)
seen_docs.add((final_url, filename))

Expand Down Expand Up @@ -574,7 +583,14 @@ def parse_referenced_documents_from_responses_api(
if (final_url, anno_title) not in seen_docs:
documents.append(
ReferencedDocument(
doc_url=final_url, doc_title=anno_title
doc_url=final_url,
doc_title=anno_title,
document_id=None,
product_name=None,
product_version=None,
source_path=None,
score=None,
chunk_metadata=None,
)
)
seen_docs.add((final_url, anno_title))
Expand All @@ -583,7 +599,14 @@ def parse_referenced_documents_from_responses_api(
if (None, anno_title) not in seen_docs:
documents.append(
ReferencedDocument(
doc_url=None, doc_title=anno_title
doc_url=None,
doc_title=anno_title,
document_id=None,
product_name=None,
product_version=None,
source_path=None,
score=None,
chunk_metadata=None,
)
)
seen_docs.add((None, anno_title))
Expand Down
25 changes: 24 additions & 1 deletion src/models/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,14 @@ class ReferencedDocument(BaseModel):
"""Model representing a document referenced in generating a response.

Attributes:
doc_url: Url to the referenced doc.
doc_url: URL to the referenced doc.
doc_title: Title of the referenced doc.
document_id: Unique identifier for the document in the RAG system.
product_name: Product name (e.g., "Red Hat OpenShift").
product_version: Product version (e.g., "4.15").
source_path: Source path or identifier for local/filesystem documents.
score: Relevance score from RAG retrieval (0.0 to 1.0).
chunk_metadata: Additional metadata fields from the RAG chunk.
"""

doc_url: Optional[AnyUrl] = Field(
Expand All @@ -341,6 +347,23 @@ class ReferencedDocument(BaseModel):
None, description="Title of the referenced document"
)

document_id: str | None = Field(
None, description="Document identifier from RAG system"
)

product_name: str | None = Field(None, description="Product name")

product_version: str | None = Field(None, description="Product version")

source_path: str | None = Field(None, description="Source path for local documents")

score: float | None = Field(None, description="Relevance score from RAG retrieval")

chunk_metadata: dict[str, Any] | None = Field(
None,
description="Additional metadata from RAG chunk",
)


class QueryResponse(AbstractSuccessfulResponse):
"""Model representing LLM response to a query.
Expand Down
Loading
Loading