Skip to main content

magentic-datacircle

Find the best GTM APIs. We benchmark all the GTM APIs and we put the results on our website.

Our website: https://datacircle.dev

This package gives magentic four functions that call Datacircle's open API, https://api.datacircle.dev/v1. You need no key and no account. Each function has type hints and a docstring. Each argument has a description. magentic reads the name, docstring and arguments of each function. magentic sends the name, docstring and arguments to the model.

Function What the function gives Call
datacircle_list_apis Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan GET /apis
datacircle_best_plans One API's plans, sorted by score out of 100, best first. Each plan comes with a rank and a price per 1,000 calls GET /apis/{slug}/best
datacircle_search_plans Plans that match a provider or plan name, on all APIs or on one API. You can sort them by score, provider or price GET /plans
datacircle_provider The APIs a provider sells, and the provider's rank on each API GET /providers/{slug}

Install

pip install magentic-datacircle magentic

magentic-datacircle works with magentic 0.40 and later, on Python 3.10 and later. magentic-datacircle does not import magentic.

magentic uses OpenAI's gpt-4o by default. To use another model for each prompt, set MAGENTIC_OPENAI_MODEL. To use another model for one prompt, pass model= to that prompt. The Datacircle functions work with each of magentic's chat models: OpenaiChatModel, AnthropicChatModel and LitellmChatModel.

Use the functions in a prompt chain

With @prompt_chain, magentic runs each function call from the model. magentic then gives each function result back to the model. magentic repeats these steps until the model has the final answer:

from magentic import prompt_chain
from magentic_datacircle import datacircle_functions


@prompt_chain("Who are the 3 best providers for the {api} API? Name each with its score.", functions=datacircle_functions())
def best_providers(api: str) -> str: ...


print(best_providers("email-finder"))

Call the function yourself

With @prompt, the model returns a FunctionCall. You choose when to call the FunctionCall:

from magentic import FunctionCall, prompt
from magentic_datacircle import datacircle_functions


@prompt("Find the best plans for the {api} API.", functions=datacircle_functions())
def plan(api: str) -> FunctionCall[str]: ...


call = plan("email-finder")
print(call())

To get many calls at once, set the return type to ParallelFunctionCall[str].

Use the Datacircle functions in a chat prompt

@chatprompt takes functions=datacircle_functions():

from magentic import FunctionCall, SystemMessage, UserMessage, chatprompt
from magentic_datacircle import datacircle_functions


@chatprompt(
    SystemMessage("Use the Datacircle functions for questions on GTM APIs."),
    UserMessage("On which APIs does {provider} rank?"),
    functions=datacircle_functions(),
)
def ranks(provider: str) -> FunctionCall[str]: ...


print(ranks("Hunter")())

Use the functions in async code

For a prompt on an async def, use datacircle_async_functions(). The async functions have the same names and arguments as the sync functions. Each async function runs the API call in a thread. Several calls then run at the same time:

import asyncio

from magentic import prompt_chain
from magentic_datacircle import datacircle_async_functions


@prompt_chain("Who is the best provider for the {api} API?", functions=datacircle_async_functions())
async def best_provider(api: str) -> str: ...


print(asyncio.run(best_provider("email-finder")))

Use the Datacircle functions beside your own functions

Put the Datacircle functions in one list with your own functions: functions=[*datacircle_functions(), my_function].

To give the model only some Datacircle functions, list the names of those functions: datacircle_functions(["datacircle_best_plans"]).

Call a function without a model

Each function runs without a model. You get the Datacircle API's answer as JSON text:

import json

from magentic_datacircle import datacircle_best_plans, run

print(json.loads(datacircle_best_plans("email-finder", limit=3))["plans"])
print(run("datacircle_provider", {"slug": "Bright Data"}))

What the model reads

Each function returns the API's answer as JSON text. magentic gives the model this text with every backend. Each plan comes with a rank, provider, plan, score, price per 1,000 (perThousand, in dollars) and a page on datacircle.dev. That page lists every field.

You can give a provider's name in place of a slug. The function turns Bright Data into bright-data.

An unknown slug gets no data from the API. With no data, the function returns {"error": "..."} and the API's message. The error for an unknown API slug lists every valid slug. The function checks each number from the model before any API call. For a number out of range, the function returns {"error": "..."} and makes no API call. If the network fails, the function returns {"error": "..."} with the network error's message. The function never raises an error. Your prompt chain keeps running. The model can call the function again.

Network

Each function call makes one HTTPS GET request to https://api.datacircle.dev/v1 and nothing else. The request holds only the function's own arguments: no key and nothing from your prompts. The API takes up to 60 calls a minute from one IP address. The API can ask the function to wait. The function then waits once, for a minute at most. Each call uses only Python's standard library. Nothing goes to disk.

Metadata

Release files for magentic-datacircle 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 magentic-datacircle 0.1.0
File Size Uploaded Provenance Actions
magentic_datacircle-0.1.0.tar.gz 12.8 kB Without provenance Details for magentic_datacircle-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for magentic-datacircle 0.1.0
File Interpreter ABI Platform Actions
magentic_datacircle-0.1.0-py3-none-any.whl Python 3 none any Details for magentic_datacircle-0.1.0-py3-none-any.whl

Total release size: 23.4 kB

Release files / magentic_datacircle-0.1.0.tar.gz

Download URL magentic_datacircle-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c4b7bff3e183f3d66cd48b65cc46579ca3778940b848eea80862224b3a9a0162
BLAKE2b-256 checksum
How to use checksums
65e733f9983ab4bfa837e466e4888d5cd0935861dce039c1a5af68bb11159da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL magentic_datacircle-0.1.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8175bc6bb2c7063e394f5d86b67101fe2cc82feac4a4cb5b033c9d6a87e0b80
BLAKE2b-256 checksum
How to use checksums
3082b5c874ed5e9f1c12dd5b7b4beb8f7a44a1c6383f02d091a00dc4a1da8fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for magentic-datacircle 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