LlamaIndex Tools Integration: ContextFetch
pip install llama-index-tools-contextfetch
This tool connects agents to ContextFetch, a web search and web page to Markdown API.
Pass api_key, or set the CONTEXTFETCH_API_KEY environment variable. With
neither, requests use ContextFetch's keyless tier, a small daily allowance per IP.
The contextfetch package can request a free starter key:
from contextfetch import ContextFetch; ContextFetch().free_key().
Usage
# %pip install llama-index llama-index-tools-contextfetch
from llama_index.tools.contextfetch import ContextFetchToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
contextfetch_tool = ContextFetchToolSpec() # or ContextFetchToolSpec(api_key="...")
agent = FunctionAgent(
tools=contextfetch_tool.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run("How do asyncio task groups handle errors?"))
Available Functions
search: Search the web. Returns each result's title, URL, published date when
known, and the passages relevant to the query.
read_page: Read a web page as Markdown. With query, only the parts of the page
relevant to it are returned.
find_similar: Find pages on other sites that are similar to a given page.
answer: Answer a question with passages quoted verbatim from web pages, each
followed by [n], then the numbered source URLs. No text is generated.
Each function returns a Markdown string that names its sources by title and URL.
To load pages as Documents for indexing, use llama-index-readers-contextfetch.
This loader is designed to be used as a way to load data as a Tool in an Agent.
Metadata
Release files for llama-index-tools-contextfetch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llama_index_tools_contextfetch-0.1.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llama_index_tools_contextfetch-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / llama_index_tools_contextfetch-0.1.0.tar.gz
| Download URL | llama_index_tools_contextfetch-0.1.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ace0c2c71620a50b2e8d9479e4c0072d71752e399940ddaaadb51544e974b66
|
|
BLAKE2b-256 checksum How to use checksums |
ec0129c6a08a382567f34886d8977457e9ddb17f95471a6fe8b2cc9709edb032
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / llama_index_tools_contextfetch-0.1.0-py3-none-any.whl
| Download URL | llama_index_tools_contextfetch-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4c354d390dd90a09cb3ba4d8f9d0a155f25a624f4e06683cdb6427992e91d16
|
|
BLAKE2b-256 checksum How to use checksums |
fe1c54913dd306bb058d2d827b608c7f7c6352976cf625b1a88d39c5d4ca5339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|