haive.core.engine.retriever.providers.YouRetrieverConfig¶

You.com Retriever implementation for the Haive framework.

from typing import Any This module provides a configuration class for the You.com retriever, which retrieves web search results using You.com’s search API. You.com provides AI-powered search capabilities with real-time web results and summarization features.

The YouRetriever works by: 1. Connecting to You.com’s search API 2. Executing search queries against the web 3. Retrieving and processing search results 4. Returning formatted documents with web content

This retriever is particularly useful when: - Need real-time web search capabilities - Building applications requiring current information - Want AI-enhanced search results - Creating research or fact-checking tools - Need alternative to traditional search engines

The implementation integrates with LangChain’s YouRetriever while providing a consistent Haive configuration interface with secure API key management.

Classes¶

YouRetrieverConfig

Configuration for You.com retriever in the Haive framework.

Module Contents¶

class haive.core.engine.retriever.providers.YouRetrieverConfig.YouRetrieverConfig[source]¶

Bases: haive.core.common.mixins.secure_config.SecureConfigMixin, haive.core.engine.retriever.retriever.BaseRetrieverConfig

Configuration for You.com retriever in the Haive framework.

This retriever searches the web using You.com’s API and returns AI-enhanced search results and summaries.

retriever_type¶

The type of retriever (always YOU).

Type:

RetrieverType

api_key¶

You.com API key (auto-resolved from YOU_API_KEY).

Type:

Optional[SecretStr]

num_web_results¶

Number of web results to retrieve.

Type:

int

safesearch¶

Safe search setting.

Type:

str

country¶

Country code for localized results.

Type:

str

search_lang¶

Language for search results.

Type:

str

Examples

>>> from haive.core.engine.retriever import YouRetrieverConfig
>>>
>>> # Create the You.com retriever config
>>> config = YouRetrieverConfig(
...     name="you_retriever",
...     num_web_results=10,
...     safesearch="moderate",
...     country="US",
...     search_lang="en"
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("latest AI developments 2024")
>>>
>>> # Example with specific search parameters
>>> tech_config = YouRetrieverConfig(
...     name="tech_you_retriever",
...     num_web_results=5,
...     safesearch="off",
...     country="US"
... )
get_input_fields()[source]¶

Return input field definitions for You.com retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for You.com retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]¶

Create a You.com retriever from this configuration.

Returns:

Instantiated retriever ready for web search.

Return type:

YouRetriever

Raises:
  • ImportError – If required packages are not available.

  • ValueError – If API key or configuration is invalid.