toolfront

Data retrieval for AI agents

GitHubスター

516

ユーザー評価

未評価

お気に入り

0

閲覧数

28

フォーク

38

イシュー

6

README

ToolFront Logo

Simple data retrieval for AI with unmatched control, precision, and speed.

Test Suite
PyPI package
Discord
X


Documentation: docs.toolfront.ai


Installation

Install with pip or your favorite PyPI package manager.

pip install toolfront
Example 1: Text2SQL with ChatGPT
from toolfront import Database

db = Database("postgres://user:pass@localhost:5432/mydb")

context = "We're an e-commerce company. Sales data is in the `cust_orders` table."

# Returns a string
answer = db.ask("What's our best-selling product?",  model="openai:gpt-4o", context=context)
# >>> "Wireless Headphones Pro"

Note: For databases, install with PyPI extras, e.g.: pip install "toolfront[postgres]". See the documentation for the complete list of 10+ databases.

Example 2: API retrieval with Claude
from toolfront import API

api = API("http://localhost:8000/openapi.json")

# Returns a list of integers
answer: list[int] = api.ask("Get the last 5 order IDs for user_id=42",  model="anthropic:claude-3-5-sonnet")
# >>> [1001, 998, 987, 976, 965]

Note: ToolFront supports any API with an OpenAPI (formerly Swagger) specification. Most common APIs like Slack, Discord, and GitHub have OpenAPI specs. See the documentation for more details.

Example 3: Document information extraction with Gemini
from toolfront import Document
from pydantic import BaseModel, Field

class CompanyReport(BaseModel):
    company_name: str = Field(..., description="Name of the company")
    revenue: int | float = Field(..., description="Annual revenue in USD")
    is_profitable: bool = Field(..., description="Whether the company is profitable")

doc = Document("/path/annual_report.pdf")

# Returns a structured Pydantic object
answer: CompanyReport = doc.ask("Extract the key company information from this report", model="google:gemini-pro")
# >>> CompanyReport(company_name="TechCorp Inc.", revenue=2500000, is_profitable=True)

Note: ToolFront supports OpenAI, Anthropic, Google, xAI, and 14+ AI model providers. See the documentation for the complete list.

Example 4: Snowflake MCP Server
{
  "mcpServers": {
    "toolfront": {
      "command": "uvx",
      "args": [
        "toolfront[snowflake]", 
        "snowflake://user:pass@account/warehouse/database"
      ]
    }
  }
}
Community & Contributing
License

This project is licensed under the terms of the MIT license.