haive.core.engine.retriever.providers.WikipediaRetrieverConfigΒΆ

Wikipedia Retriever implementation for the Haive framework.

from typing import Any This module provides a configuration class for the Wikipedia retriever, which retrieves articles from Wikipedia based on search queries.

The WikipediaRetriever works by: 1. Taking a search query 2. Searching Wikipedia for matching articles 3. Returning article content as documents

This retriever is particularly useful when: - Need access to encyclopedic knowledge - Building general knowledge applications - Combining with other retrievers for comprehensive coverage - Providing factual background information

The implementation integrates with LangChain’s WikipediaRetriever while providing a consistent Haive configuration interface.

ClassesΒΆ

WikipediaRetrieverConfig

Configuration for Wikipedia retriever in the Haive framework.

Module ContentsΒΆ

class haive.core.engine.retriever.providers.WikipediaRetrieverConfig.WikipediaRetrieverConfig[source]ΒΆ

Bases: haive.core.engine.retriever.retriever.BaseRetrieverConfig

Configuration for Wikipedia retriever in the Haive framework.

This retriever searches Wikipedia for articles matching the query and returns their content as documents.

retriever_typeΒΆ

The type of retriever (always WIKIPEDIA).

Type:

RetrieverType

top_k_resultsΒΆ

Maximum number of articles to retrieve (default: 3).

Type:

int

langΒΆ

Language code for Wikipedia (default: β€œen”).

Type:

str

load_max_docsΒΆ

Maximum number of documents to load (default: 100).

Type:

int

load_all_available_metaΒΆ

Whether to load all available metadata (default: False).

Type:

bool

Examples

>>> from haive.core.engine.retriever import WikipediaRetrieverConfig
>>>
>>> # Create the wikipedia retriever config
>>> config = WikipediaRetrieverConfig(
...     name="wikipedia_retriever",
...     top_k_results=5,
...     lang="en"
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("artificial intelligence")
get_input_fields()[source]ΒΆ

Return input field definitions for Wikipedia retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]ΒΆ

Return output field definitions for Wikipedia retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]ΒΆ

Create a Wikipedia retriever from this configuration.

Returns:

Instantiated retriever ready for document retrieval.

Return type:

WikipediaRetriever

Raises:

ImportError – If required packages are not available.