Watson Discovery
WatsonDiscoveryRetriever #
Bases: BaseRetriever
Provides functionality to interact with IBM Watson Discovery for querying documents.
For more information, see IBM Watson Discovery Getting Started
Attributes:
| Name | Type | Description |
|---|---|---|
url |
str
|
Watson Discovery instance URL. |
api_key |
str
|
Watson Discovery API key. |
project_id |
str
|
Watson Discovery project ID. |
version |
str
|
Watson Discovery API version. Defaults to |
disable_passages |
bool
|
Return the full document instead of passages.
Only enable this if all documents are short. Defaults to |
Example
from beekeeper.retrievers.watson_discovery import WatsonDiscoveryRetriever
doc_retriever = WatsonDiscoveryRetriever(
url="your_url", api_key="your_api_key", project_id="your_project_id"
)
model_post_init #
model_post_init(__context)
Initialize Watson Discovery client after Pydantic validation.
query_documents #
query_documents(query: str, filter: str | None = None, top_k: int = 4, **kwargs: Any) -> list[DocumentWithScore]
Search your data in the Discovery API and return a list of documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Query text. |
required |
filter
|
str
|
Searches for documents that match the filter.
Use Discovery Query Language syntax. Defaults to |
None
|
top_k
|
int
|
Number of top results to return. Defaults to |
4
|
Example
docs = doc_retriever.query_documents("What's Beekeeper Framework?")