Skip to content

API

API

API(spec=None, headers=None, params=None, **kwargs)

Natural language interface for OpenAPI/Swagger APIs.

PARAMETER DESCRIPTION
spec

OpenAPI specification as URL, file path, or dictionary.

TYPE: dict | str DEFAULT: None

headers

HTTP headers for authentication.

TYPE: dict[str, str] DEFAULT: None

params

Query parameters for all requests.

TYPE: dict[str, str] DEFAULT: None

ask

ask(prompt, model=None, context=None, output_type=None, stream=False)

Ask natural language questions and get structured responses.

PARAMETER DESCRIPTION
prompt

Natural language question or instruction.

TYPE: str

model

AI model to use (e.g., 'openai:gpt-4', 'anthropic:claude-3-5-sonnet').

TYPE: str DEFAULT: None

context

Additional business context for better responses.

TYPE: str DEFAULT: None

output_type

Pydantic model for structured responses.

TYPE: BaseModel DEFAULT: None

stream

Show live AI reasoning in terminal.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
Any

Response matching the requested output type.

tools

tools()

Available tool methods for API operations.

RETURNS DESCRIPTION
list[callable]

Methods for endpoint inspection and request execution.

instructions

instructions(context=None)

Generate system instructions for AI agents.

PARAMETER DESCRIPTION
context

Additional business context to include in instructions.

TYPE: str DEFAULT: None

RETURNS DESCRIPTION
str

System instructions for AI interaction with this datasource.