Skip to content

Seltz

SeltzToolSpec #

Bases: BaseToolSpec

Seltz web knowledge tool spec.

Seltz provides fast, up-to-date web data with context-engineered web content and sources for real-time AI reasoning.

Source code in .build/python/llama-index-integrations/tools/llama-index-tools-seltz/llama_index/tools/seltz/base.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class SeltzToolSpec(BaseToolSpec):
    """
    Seltz web knowledge tool spec.

    Seltz provides fast, up-to-date web data with context-engineered
    web content and sources for real-time AI reasoning.
    """

    spec_functions = ["search"]

    def __init__(self, api_key: str) -> None:
        """
        Initialize with parameters.

        Args:
            api_key: Seltz API key. Obtain one at https://www.seltz.ai/

        """
        self.client = Seltz(api_key=api_key)

    def search(self, query: str, max_documents: Optional[int] = 10) -> List[Document]:
        """
        Search the web using Seltz and return relevant documents with sources.

        Args:
            query: The search query text.
            max_documents: Maximum number of documents to return (default: 10).

        Returns:
            A list of Document objects containing web content and source URLs.

        """
        includes = Includes(max_documents=max_documents) if max_documents else None
        response = self.client.search(query, includes=includes)
        return [
            Document(text=doc.content or "", metadata={"url": doc.url or ""})
            for doc in response.documents
        ]

search #

search(
    query: str, max_documents: Optional[int] = 10
) -> List[Document]

Search the web using Seltz and return relevant documents with sources.

Parameters:

Name Type Description Default
query str

The search query text.

required
max_documents Optional[int]

Maximum number of documents to return (default: 10).

10

Returns:

Type Description
List[Document]

A list of Document objects containing web content and source URLs.

Source code in .build/python/llama-index-integrations/tools/llama-index-tools-seltz/llama_index/tools/seltz/base.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def search(self, query: str, max_documents: Optional[int] = 10) -> List[Document]:
    """
    Search the web using Seltz and return relevant documents with sources.

    Args:
        query: The search query text.
        max_documents: Maximum number of documents to return (default: 10).

    Returns:
        A list of Document objects containing web content and source URLs.

    """
    includes = Includes(max_documents=max_documents) if max_documents else None
    response = self.client.search(query, includes=includes)
    return [
        Document(text=doc.content or "", metadata={"url": doc.url or ""})
        for doc in response.documents
    ]

options: members: - SeltzToolSpec