Skip to main content

dspy-contextfetch

ContextFetch web search and page reading as DSPy tools.

pip install dspy-contextfetch
export CONTEXTFETCH_API_KEY="..."   # optional: without a key, requests use the keyless tier
import dspy
from dspy_contextfetch import read_page, web_search

dspy.configure(lm=dspy.LM("openai/gpt-4o-mini"))
agent = dspy.ReAct("question -> answer", tools=[web_search, read_page])
print(agent(question="What does asyncio.TaskGroup do when a task fails?").answer)
  • web_search(query, num_results=5, include_domains=None, start_published_date=None): the top results as Markdown, each with title, URL, published date and the parts of the page relevant to the query.
  • read_page(url, query=None): one page as Markdown; with query, only the parts relevant to it.

Both are plain functions over the contextfetch SDK, so they also work with dspy.Tool(...) or called directly. Errors from the API raise contextfetch.ContextFetchError.

Tests

uv run --group test pytest

The live test runs when ~/.contextfetch_smoke_key exists.

Metadata

Release files for dspy-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)

Source distribution for dspy-contextfetch 0.1.0
File Size Uploaded Provenance Actions
dspy_contextfetch-0.1.0.tar.gz 3.6 kB Without provenance Details for dspy_contextfetch-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dspy-contextfetch 0.1.0
File Interpreter ABI Platform Actions
dspy_contextfetch-0.1.0-py3-none-any.whl Python 3 none any Details for dspy_contextfetch-0.1.0-py3-none-any.whl

Total release size: 7.2 kB

Release files / dspy_contextfetch-0.1.0.tar.gz

Download URL dspy_contextfetch-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
12ea203f18c9ddaef137785482778d15988a52e7f0754fe919221a94be1f9c26
BLAKE2b-256 checksum
How to use checksums
7ea148c7f33c5f92fdc385f9843d78337fe76c063286dd619a909af1a285040c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / dspy_contextfetch-0.1.0-py3-none-any.whl

Download URL dspy_contextfetch-0.1.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd2927cfa74c3a0ba53a494ec2fc90e2025a436ba2966bf69be75b1b9793c1f9
BLAKE2b-256 checksum
How to use checksums
89fb354991dcae6a6018b01e0020319211e7824c756c34ed15fbb4102a4afaa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for dspy-contextfetch 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page