gen_ai_hub.document_grounding.models.retrieval module¶
Pydantic models for Retrieval API.
This module defines data models for the Retrieval API, which enables querying and retrieving relevant content from configured data repositories (vector stores and external document sources).
- Model categories:
Data repository models (repository information and metadata)
Chunk and document models (content structure)
Search filter and configuration models (query parameters)
Search input and result models (request/response structures)
The Retrieval API supports semantic search combined with metadata filtering for precise content retrieval across multiple repository types.
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair(*, key: str, value: List[str])¶
Bases:
BaseModel- key: str¶
- value: List[str]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalDocumentKeyValueListPair(*, key: str, value: List[str], matchMode: str | None)¶
Bases:
RetrievalKeyValueListPair- matchMode: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- key: str¶
- value: List[str]¶
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchDocumentKeyValueListPair(*, key: str, value: List[str], selectMode: List[str] | None = None)¶
Bases:
BaseModel- key: str¶
- value: List[str]¶
- selectMode: List[str] | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalChunk(*, id: str, content: str, metadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair] | None = <factory>)¶
Bases:
BaseModel- id: str¶
- content: str¶
- metadata: List[RetrievalKeyValueListPair] | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalDocument(*, id: str, metadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalDocumentKeyValueListPair] | None = <factory>, chunks: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalChunk])¶
Bases:
BaseModel- id: str¶
- metadata: List[RetrievalDocumentKeyValueListPair] | None¶
- chunks: List[RetrievalChunk]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.DataRepository(*, id: str, title: str, type: ~typing.Literal['vector', 'help.sap.com'] | str, metadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair] | None = <factory>)¶
Bases:
BaseModel- id: str¶
- title: str¶
- type: Literal['vector', 'help.sap.com'] | str¶
- metadata: List[RetrievalKeyValueListPair] | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.DataRepositoryWithDocuments(*, id: str, title: str, metadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair] | None = <factory>, documents: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalDocument])¶
Bases:
BaseModel- id: str¶
- title: str¶
- metadata: List[RetrievalKeyValueListPair] | None¶
- documents: List[RetrievalDocument]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchConfiguration(*, maxChunkCount: int | None = None, maxDocumentCount: int | None = None)¶
Bases:
BaseModel- maxChunkCount: int | None¶
- maxDocumentCount: int | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchFilter(*, id: str, dataRepositoryType: ~typing.Literal['vector', 'help.sap.com'] | str, searchConfiguration: ~gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchConfiguration | None = <factory>, dataRepositories: ~typing.List[str] | None = <factory>, dataRepositoryMetadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair] | None = <factory>, documentMetadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchDocumentKeyValueListPair] | None = <factory>, chunkMetadata: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalKeyValueListPair] | None = <factory>)¶
Bases:
BaseModel- id: str¶
- dataRepositoryType: Literal['vector', 'help.sap.com'] | str¶
- searchConfiguration: RetrievalSearchConfiguration | None¶
- dataRepositories: List[str] | None¶
- dataRepositoryMetadata: List[RetrievalKeyValueListPair] | None¶
- documentMetadata: List[RetrievalSearchDocumentKeyValueListPair] | None¶
- chunkMetadata: List[RetrievalKeyValueListPair] | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchInput(*, query: str, filters: List[RetrievalSearchFilter])¶
Bases:
BaseModel- query: str¶
- filters: List[RetrievalSearchFilter]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalDataRepositorySearchResult(*, dataRepository: DataRepositoryWithDocuments)¶
Bases:
BaseModel- dataRepository: DataRepositoryWithDocuments¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalPerFilterSearchResult(*, filterId: str, results: ~typing.List[~gen_ai_hub.document_grounding.models.retrieval.RetrievalDataRepositorySearchResult] = <factory>)¶
Bases:
BaseModel- filterId: str¶
- results: List[RetrievalDataRepositorySearchResult]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalPerFilterSearchResultError(*, message: str)¶
Bases:
BaseModel- message: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalPerFilterSearchResultWithError(*, filterId: str, error: RetrievalPerFilterSearchResultError)¶
Bases:
BaseModel- filterId: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.RetrievalSearchResults(*, results: List[RetrievalPerFilterSearchResult | RetrievalPerFilterSearchResultWithError])¶
Bases:
BaseModel- results: List[RetrievalPerFilterSearchResult | RetrievalPerFilterSearchResultWithError]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.document_grounding.models.retrieval.DataRepositories(*, count: int | None = None, resources: List[DataRepository])¶
Bases:
BaseModel- count: int | None¶
- resources: List[DataRepository]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].