Skip to content

searchly_config

Class info

Re-exported classes

Class Module Description
BaseSearchProviderConfig searchly_config.configs Base search provider configuration.
BraveSearchConfig searchly_config.configs Brave Search provider configuration.
DataForSEOConfig searchly_config.configs DataForSEO provider configuration.
ExaConfig searchly_config.configs Exa provider configuration.
JigsawStackConfig searchly_config.configs JigsawStack provider configuration.
KagiConfig searchly_config.configs Kagi provider configuration.
LinkUpConfig searchly_config.configs LinkUp provider configuration.
Search1Config searchly_config.configs Search1API provider configuration.
SerpAPIConfig searchly_config.configs SerpAPI provider configuration.
SerperConfig searchly_config.configs Serper provider configuration.
TavilyConfig searchly_config.configs Tavily provider configuration.
YouConfig searchly_config.configs You.com provider configuration.

🛈 DocStrings

Search provider configuration.

This is a lightweight config-only package for fast imports. For the actual search providers, use from searchly import ....

BaseSearchProviderConfig

Bases: Schema

Base search provider configuration.

Source code in src/searchly_config/configs.py
class BaseSearchProviderConfig(Schema):
    """Base search provider configuration."""

    type: str = Field(init=False)
    """Search provider type."""

    def is_configured(self) -> bool:
        """Check if the provider has required credentials configured.

        Returns:
            True if credentials are set via field or environment variable.
        """
        raise NotImplementedError

    def get_provider(self) -> WebSearchProvider | NewsSearchProvider:
        """Create the provider instance.

        Returns:
            The configured provider instance.
        """
        raise NotImplementedError

type class-attribute instance-attribute

type: str = Field(init=False)

Search provider type.

get_provider

Create the provider instance.

Returns:

Type Description
WebSearchProvider | NewsSearchProvider

The configured provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> WebSearchProvider | NewsSearchProvider:
    """Create the provider instance.

    Returns:
        The configured provider instance.
    """
    raise NotImplementedError

is_configured

is_configured() -> bool

Check if the provider has required credentials configured.

Returns:

Type Description
bool

True if credentials are set via field or environment variable.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if the provider has required credentials configured.

    Returns:
        True if credentials are set via field or environment variable.
    """
    raise NotImplementedError

BraveSearchConfig

Bases: BaseSearchProviderConfig

Brave Search provider configuration.

Uses the Brave Search API for web and news search. Supports country and language filtering.

Source code in src/searchly_config/configs.py
class BraveSearchConfig(BaseSearchProviderConfig):
    """Brave Search provider configuration.

    Uses the Brave Search API for web and news search.
    Supports country and language filtering.
    """

    type: Literal["brave"] = Field("brave", init=False)
    """Brave Search provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Brave Search API key. Defaults to BRAVE_API_KEY env var."""

    retries: int = Field(default=0, ge=0, title="Retries", examples=[0, 3, 5])
    """Number of retries for failed requests."""

    wait_time: int = Field(default=2, ge=0, title="Wait Time", examples=[1, 2, 5])
    """Time to wait between retries in seconds."""

    def is_configured(self) -> bool:
        """Check if Brave Search credentials are configured."""
        return self.api_key is not None or bool(os.getenv("BRAVE_API_KEY"))

    def get_provider(self) -> AsyncBraveSearch:
        """Create Brave Search provider instance."""
        from searchly.providers.brave_provider.client import AsyncBraveSearch

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncBraveSearch(
            api_key=api_key,
            retries=self.retries,
            wait_time=self.wait_time,
        )

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Brave Search API key. Defaults to BRAVE_API_KEY env var.

retries class-attribute instance-attribute

retries: int = Field(default=0, ge=0, title='Retries', examples=[0, 3, 5])

Number of retries for failed requests.

type class-attribute instance-attribute

type: Literal['brave'] = Field('brave', init=False)

Brave Search provider.

wait_time class-attribute instance-attribute

wait_time: int = Field(default=2, ge=0, title='Wait Time', examples=[1, 2, 5])

Time to wait between retries in seconds.

get_provider

get_provider() -> AsyncBraveSearch

Create Brave Search provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncBraveSearch:
    """Create Brave Search provider instance."""
    from searchly.providers.brave_provider.client import AsyncBraveSearch

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncBraveSearch(
        api_key=api_key,
        retries=self.retries,
        wait_time=self.wait_time,
    )

is_configured

is_configured() -> bool

Check if Brave Search credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Brave Search credentials are configured."""
    return self.api_key is not None or bool(os.getenv("BRAVE_API_KEY"))

DataForSEOConfig

Bases: BaseSearchProviderConfig

DataForSEO provider configuration.

Uses the DataForSEO API for web and news search. Supports country and language filtering with device/OS options.

Source code in src/searchly_config/configs.py
class DataForSEOConfig(BaseSearchProviderConfig):
    """DataForSEO provider configuration.

    Uses the DataForSEO API for web and news search.
    Supports country and language filtering with device/OS options.
    """

    type: Literal["dataforseo"] = Field("dataforseo", init=False)
    """DataForSEO provider."""

    login: SecretStr | None = Field(default=None, title="Login")
    """DataForSEO login. Defaults to DATAFORSEO_LOGIN env var."""

    password: SecretStr | None = Field(default=None, title="Password")
    """DataForSEO password. Defaults to DATAFORSEO_PASSWORD env var."""

    base_url: str = Field(default="https://api.dataforseo.com/v3", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if DataForSEO credentials are configured."""
        has_login = self.login is not None or bool(os.getenv("DATAFORSEO_LOGIN"))
        has_password = self.password is not None or bool(os.getenv("DATAFORSEO_PASSWORD"))
        return has_login and has_password

    def get_provider(self) -> AsyncDataForSEOClient:
        """Create DataForSEO provider instance."""
        from searchly.providers.dataforseo_provider.dataforseo import AsyncDataForSEOClient

        login = self.login.get_secret_value() if self.login else None
        password = self.password.get_secret_value() if self.password else None
        return AsyncDataForSEOClient(
            login=login,
            password=password,
            base_url=self.base_url,
        )

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.dataforseo.com/v3', title='Base URL')

Base URL for the API.

login class-attribute instance-attribute

login: SecretStr | None = Field(default=None, title='Login')

DataForSEO login. Defaults to DATAFORSEO_LOGIN env var.

password class-attribute instance-attribute

password: SecretStr | None = Field(default=None, title='Password')

DataForSEO password. Defaults to DATAFORSEO_PASSWORD env var.

type class-attribute instance-attribute

type: Literal['dataforseo'] = Field('dataforseo', init=False)

DataForSEO provider.

get_provider

get_provider() -> AsyncDataForSEOClient

Create DataForSEO provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncDataForSEOClient:
    """Create DataForSEO provider instance."""
    from searchly.providers.dataforseo_provider.dataforseo import AsyncDataForSEOClient

    login = self.login.get_secret_value() if self.login else None
    password = self.password.get_secret_value() if self.password else None
    return AsyncDataForSEOClient(
        login=login,
        password=password,
        base_url=self.base_url,
    )

is_configured

is_configured() -> bool

Check if DataForSEO credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if DataForSEO credentials are configured."""
    has_login = self.login is not None or bool(os.getenv("DATAFORSEO_LOGIN"))
    has_password = self.password is not None or bool(os.getenv("DATAFORSEO_PASSWORD"))
    return has_login and has_password

ExaConfig

Bases: BaseSearchProviderConfig

Exa provider configuration.

Uses the Exa API for neural/semantic web search. Supports domain filtering and date ranges but not country/language.

Source code in src/searchly_config/configs.py
class ExaConfig(BaseSearchProviderConfig):
    """Exa provider configuration.

    Uses the Exa API for neural/semantic web search.
    Supports domain filtering and date ranges but not country/language.
    """

    type: Literal["exa"] = Field("exa", init=False)
    """Exa provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Exa API key. Defaults to EXA_API_KEY env var."""

    def is_configured(self) -> bool:
        """Check if Exa credentials are configured."""
        return self.api_key is not None or bool(os.getenv("EXA_API_KEY"))

    def get_provider(self) -> AsyncExaClient:
        """Create Exa provider instance."""
        from searchly.providers.exa_provider.exa import AsyncExaClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncExaClient(api_key=api_key)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Exa API key. Defaults to EXA_API_KEY env var.

type class-attribute instance-attribute

type: Literal['exa'] = Field('exa', init=False)

Exa provider.

get_provider

get_provider() -> AsyncExaClient

Create Exa provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncExaClient:
    """Create Exa provider instance."""
    from searchly.providers.exa_provider.exa import AsyncExaClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncExaClient(api_key=api_key)

is_configured

is_configured() -> bool

Check if Exa credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Exa credentials are configured."""
    return self.api_key is not None or bool(os.getenv("EXA_API_KEY"))

JigsawStackConfig

Bases: BaseSearchProviderConfig

JigsawStack provider configuration.

Uses the JigsawStack API for web search with AI overview. Limited filtering options.

Source code in src/searchly_config/configs.py
class JigsawStackConfig(BaseSearchProviderConfig):
    """JigsawStack provider configuration.

    Uses the JigsawStack API for web search with AI overview.
    Limited filtering options.
    """

    type: Literal["jigsawstack"] = Field("jigsawstack", init=False)
    """JigsawStack provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """JigsawStack API key. Defaults to JIGSAWSTACK_API_KEY env var."""

    base_url: str = Field(default="https://api.jigsawstack.com/v1", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if JigsawStack credentials are configured."""
        return self.api_key is not None or bool(os.getenv("JIGSAWSTACK_API_KEY"))

    def get_provider(self) -> AsyncJigsawStackClient:
        """Create JigsawStack provider instance."""
        from searchly.providers.jigsawstack_provider.jigsawstack import AsyncJigsawStackClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncJigsawStackClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

JigsawStack API key. Defaults to JIGSAWSTACK_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.jigsawstack.com/v1', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['jigsawstack'] = Field('jigsawstack', init=False)

JigsawStack provider.

get_provider

get_provider() -> AsyncJigsawStackClient

Create JigsawStack provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncJigsawStackClient:
    """Create JigsawStack provider instance."""
    from searchly.providers.jigsawstack_provider.jigsawstack import AsyncJigsawStackClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncJigsawStackClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if JigsawStack credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if JigsawStack credentials are configured."""
    return self.api_key is not None or bool(os.getenv("JIGSAWSTACK_API_KEY"))

KagiConfig

Bases: BaseSearchProviderConfig

Kagi provider configuration.

Uses the Kagi API for web search. Also supports summarization via the Universal Summarizer.

Source code in src/searchly_config/configs.py
class KagiConfig(BaseSearchProviderConfig):
    """Kagi provider configuration.

    Uses the Kagi API for web search.
    Also supports summarization via the Universal Summarizer.
    """

    type: Literal["kagi"] = Field("kagi", init=False)
    """Kagi provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Kagi API key. Defaults to KAGI_API_KEY env var."""

    base_url: str = Field(default="https://kagi.com/api/v0", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if Kagi credentials are configured."""
        return self.api_key is not None or bool(os.getenv("KAGI_API_KEY"))

    def get_provider(self) -> AsyncKagiClient:
        """Create Kagi provider instance."""
        from searchly.providers.kagi_provider.client import AsyncKagiClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncKagiClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Kagi API key. Defaults to KAGI_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://kagi.com/api/v0', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['kagi'] = Field('kagi', init=False)

Kagi provider.

get_provider

get_provider() -> AsyncKagiClient

Create Kagi provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncKagiClient:
    """Create Kagi provider instance."""
    from searchly.providers.kagi_provider.client import AsyncKagiClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncKagiClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if Kagi credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Kagi credentials are configured."""
    return self.api_key is not None or bool(os.getenv("KAGI_API_KEY"))

LinkUpConfig

Bases: BaseSearchProviderConfig

LinkUp provider configuration.

Uses the LinkUp API for web search with sourced answers. Limited filtering options.

Source code in src/searchly_config/configs.py
class LinkUpConfig(BaseSearchProviderConfig):
    """LinkUp provider configuration.

    Uses the LinkUp API for web search with sourced answers.
    Limited filtering options.
    """

    type: Literal["linkup"] = Field("linkup", init=False)
    """LinkUp provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """LinkUp API key. Defaults to LINKUP_API_KEY env var."""

    base_url: str = Field(default="https://api.linkup.so/v1", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if LinkUp credentials are configured."""
        return self.api_key is not None or bool(os.getenv("LINKUP_API_KEY"))

    def get_provider(self) -> AsyncLinkUpClient:
        """Create LinkUp provider instance."""
        from searchly.providers.linkup_provider.client import AsyncLinkUpClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncLinkUpClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

LinkUp API key. Defaults to LINKUP_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.linkup.so/v1', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['linkup'] = Field('linkup', init=False)

LinkUp provider.

get_provider

get_provider() -> AsyncLinkUpClient

Create LinkUp provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncLinkUpClient:
    """Create LinkUp provider instance."""
    from searchly.providers.linkup_provider.client import AsyncLinkUpClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncLinkUpClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if LinkUp credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if LinkUp credentials are configured."""
    return self.api_key is not None or bool(os.getenv("LINKUP_API_KEY"))

Search1Config

Bases: BaseSearchProviderConfig

Search1API provider configuration.

Uses the Search1API for web search via Google or Bing. Supports language filtering and time ranges.

Source code in src/searchly_config/configs.py
class Search1Config(BaseSearchProviderConfig):
    """Search1API provider configuration.

    Uses the Search1API for web search via Google or Bing.
    Supports language filtering and time ranges.
    """

    type: Literal["search1"] = Field("search1", init=False)
    """Search1API provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Search1API key. Defaults to SEARCH1API_KEY env var."""

    base_url: str = Field(
        default="https://api.search1api.com",
        title="Base URL",
    )
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if Search1API credentials are configured."""
        return self.api_key is not None or bool(os.getenv("SEARCH1API_KEY"))

    def get_provider(self) -> AsyncSearch1API:
        """Create Search1API provider instance."""
        from searchly.providers.search1_provider.client import AsyncSearch1API

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncSearch1API(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Search1API key. Defaults to SEARCH1API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.search1api.com', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['search1'] = Field('search1', init=False)

Search1API provider.

get_provider

get_provider() -> AsyncSearch1API

Create Search1API provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncSearch1API:
    """Create Search1API provider instance."""
    from searchly.providers.search1_provider.client import AsyncSearch1API

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncSearch1API(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if Search1API credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Search1API credentials are configured."""
    return self.api_key is not None or bool(os.getenv("SEARCH1API_KEY"))

SerpAPIConfig

Bases: BaseSearchProviderConfig

SerpAPI provider configuration.

Uses SerpAPI for web and news search via Google. Full support for country, language, and location filtering.

Source code in src/searchly_config/configs.py
class SerpAPIConfig(BaseSearchProviderConfig):
    """SerpAPI provider configuration.

    Uses SerpAPI for web and news search via Google.
    Full support for country, language, and location filtering.
    """

    type: Literal["serpapi"] = Field("serpapi", init=False)
    """SerpAPI provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """SerpAPI key. Defaults to SERPAPI_KEY env var."""

    def is_configured(self) -> bool:
        """Check if SerpAPI credentials are configured."""
        return self.api_key is not None or bool(os.getenv("SERPAPI_KEY"))

    def get_provider(self) -> AsyncSerpAPIClient:
        """Create SerpAPI provider instance."""
        from searchly.providers.serpapi_provider.client import AsyncSerpAPIClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncSerpAPIClient(api_key=api_key)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

SerpAPI key. Defaults to SERPAPI_KEY env var.

type class-attribute instance-attribute

type: Literal['serpapi'] = Field('serpapi', init=False)

SerpAPI provider.

get_provider

get_provider() -> AsyncSerpAPIClient

Create SerpAPI provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncSerpAPIClient:
    """Create SerpAPI provider instance."""
    from searchly.providers.serpapi_provider.client import AsyncSerpAPIClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncSerpAPIClient(api_key=api_key)

is_configured

is_configured() -> bool

Check if SerpAPI credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if SerpAPI credentials are configured."""
    return self.api_key is not None or bool(os.getenv("SERPAPI_KEY"))

SerperConfig

Bases: BaseSearchProviderConfig

Serper provider configuration.

Uses the Serper.dev API for web and news search via Google. Supports country, language, and location filtering.

Source code in src/searchly_config/configs.py
class SerperConfig(BaseSearchProviderConfig):
    """Serper provider configuration.

    Uses the Serper.dev API for web and news search via Google.
    Supports country, language, and location filtering.
    """

    type: Literal["serper"] = Field("serper", init=False)
    """Serper provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Serper.dev API key. Defaults to SERPER_API_KEY env var."""

    base_url: str = Field(default="https://google.serper.dev", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if Serper credentials are configured."""
        return self.api_key is not None or bool(os.getenv("SERPER_API_KEY"))

    def get_provider(self) -> AsyncSerperClient:
        """Create Serper provider instance."""
        from searchly.providers.serper_provider.client import AsyncSerperClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncSerperClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Serper.dev API key. Defaults to SERPER_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://google.serper.dev', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['serper'] = Field('serper', init=False)

Serper provider.

get_provider

get_provider() -> AsyncSerperClient

Create Serper provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncSerperClient:
    """Create Serper provider instance."""
    from searchly.providers.serper_provider.client import AsyncSerperClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncSerperClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if Serper credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Serper credentials are configured."""
    return self.api_key is not None or bool(os.getenv("SERPER_API_KEY"))

TavilyConfig

Bases: BaseSearchProviderConfig

Tavily provider configuration.

Uses the Tavily API for web and news search. Supports domain filtering and search depth options.

Source code in src/searchly_config/configs.py
class TavilyConfig(BaseSearchProviderConfig):
    """Tavily provider configuration.

    Uses the Tavily API for web and news search.
    Supports domain filtering and search depth options.
    """

    type: Literal["tavily"] = Field("tavily", init=False)
    """Tavily provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """Tavily API key. Defaults to TAVILY_API_KEY env var."""

    def is_configured(self) -> bool:
        """Check if Tavily credentials are configured."""
        return self.api_key is not None or bool(os.getenv("TAVILY_API_KEY"))

    def get_provider(self) -> AsyncTavilyClient:
        """Create Tavily provider instance."""
        from searchly.providers.tavily_provider.client import AsyncTavilyClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncTavilyClient(api_key=api_key)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

Tavily API key. Defaults to TAVILY_API_KEY env var.

type class-attribute instance-attribute

type: Literal['tavily'] = Field('tavily', init=False)

Tavily provider.

get_provider

get_provider() -> AsyncTavilyClient

Create Tavily provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncTavilyClient:
    """Create Tavily provider instance."""
    from searchly.providers.tavily_provider.client import AsyncTavilyClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncTavilyClient(api_key=api_key)

is_configured

is_configured() -> bool

Check if Tavily credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if Tavily credentials are configured."""
    return self.api_key is not None or bool(os.getenv("TAVILY_API_KEY"))

YouConfig

Bases: BaseSearchProviderConfig

You.com provider configuration.

Uses the You.com API for web and news search. Supports country, language, and freshness filtering.

Source code in src/searchly_config/configs.py
class YouConfig(BaseSearchProviderConfig):
    """You.com provider configuration.

    Uses the You.com API for web and news search.
    Supports country, language, and freshness filtering.
    """

    type: Literal["you"] = Field("you", init=False)
    """You.com provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """You.com API key. Defaults to YOU_API_KEY env var."""

    base_url: str = Field(default="https://api.ydc-index.io", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if You.com credentials are configured."""
        return self.api_key is not None or bool(os.getenv("YOU_API_KEY"))

    def get_provider(self) -> AsyncYouClient:
        """Create You.com provider instance."""
        from searchly.providers.you_provider.you import AsyncYouClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncYouClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

You.com API key. Defaults to YOU_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.ydc-index.io', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['you'] = Field('you', init=False)

You.com provider.

get_provider

get_provider() -> AsyncYouClient

Create You.com provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncYouClient:
    """Create You.com provider instance."""
    from searchly.providers.you_provider.you import AsyncYouClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncYouClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if You.com credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if You.com credentials are configured."""
    return self.api_key is not None or bool(os.getenv("YOU_API_KEY"))

get_config_class

get_config_class(provider_name: WebSearchProviderName) -> type[BaseSearchProviderConfig]

Get the config class for a provider name.

Parameters:

Name Type Description Default
provider_name WebSearchProviderName

The provider type literal value.

required

Returns:

Type Description
type[BaseSearchProviderConfig]

The corresponding config class.

Raises:

Type Description
ValueError

If the provider name is unknown.

Source code in src/searchly_config/configs.py
def get_config_class(
    provider_name: WebSearchProviderName,
) -> type[BaseSearchProviderConfig]:
    """Get the config class for a provider name.

    Args:
        provider_name: The provider type literal value.

    Returns:
        The corresponding config class.

    Raises:
        ValueError: If the provider name is unknown.
    """
    for cls in BaseSearchProviderConfig.__subclasses__():
        if cls.model_fields["type"].default == provider_name:
            return cls
    msg = f"Unknown provider: {provider_name}"
    raise ValueError(msg)