Machine view. [Human page](/docs/integrations/llm-tool-definitions) · [Markdown](/docs/integrations/llm-tool-definitions.md)
# LLM tool definitions.
Docs · Integrations · Human page: https://quelvio.com/docs/integrations/llm-tool-definitions · Machine view: https://quelvio.com/ai/docs/integrations/llm-tool-definitions
Direct integration patterns for OpenAI, Anthropic, and Mistral function-calling — no framework required.
[Start with the endpoint](https://quelvio.com/docs/integrations/llm-tool-definitions#endpoint) · [REST API reference](https://api.quelvio.com/openapi.json)
## Overview
If you're building an AI product directly against an LLM provider's API — OpenAI function calling, Anthropic tool use, Mistral function calling — and you don't want a framework layer like LangChain or LlamaIndex sitting between your code and the model, this page gives you the JSON specs you need to wire Quelvio in as a tool the model can call.
Each provider's spec maps the same Quelvio endpoint — POST /v1/enterprise/query — into that provider's expected schema. The model picks when to call quelvio_query; your executor posts to Quelvio's REST API and feeds the cited answer back to the model. One endpoint, three thin wrappers.
If you ARE using a framework, jump to the [framework SDKs](#frameworks) section — the dedicated packages handle retries, citation parsing, and conversation memory for you.
## Query endpoint
POST /v1/enterprise/query takes a natural-language query, an optional retrieval mode, a result limit, and an optional domain_filter. It returns a synthesized answer with [N] citation markers and a sources array carrying provenance for each citation. Every request is attributed to the human user via their Personal Access Token — per-employee permissions and audit trails apply automatically.
### Request body
```json{
"query": "what is our deployment runbook?",
"mode": "standard",
"limit": 5,
"domain_filter": "engineering"
}```### Response body
```json{
"query_id": "9f3a4d8c-7b2e-4a3d-b1c5-1f2e3d4a5b6c",
"synthesis": "Production deploys go through GitHub Actions [1]. The rollback runbook lives in Confluence [2]...",
"sources": [
{
"n": 1,
"title": ".github/workflows/deploy.yml",
"connector": "github",
"contributor": "[email protected]",
"updated_at": "2026-04-12T10:14:00Z"
},
{
"n": 2,
"title": "Runbooks / Rollback",
"connector": "confluence",
"contributor": "[email protected]",
"updated_at": "2026-03-28T09:02:00Z"
}
],
"meta": { "kT": 12500, "latency_ms": 1820, "coverage": "high" }
}```Full schema, error codes, and rate-limit headers live in the OpenAPI document at api.quelvio.com/openapi.json.
## OpenAI function calling
OpenAI's function-calling API expects each tool as a { type: "function", function: { name, description, parameters } } object inside the tools array on chat.completions.create. The parameters field is a JSON Schema describing the arguments the model is allowed to pass.
### Tool definition
```json{
"type": "function",
"function": {
"name": "quelvio_query",
"description": "Query the company's authority-scored, lifecycle-aware knowledge brain. Returns cited answers with provenance. Use when the user asks about internal company knowledge (policies, runbooks, decisions, documentation, project status).",
"parameters": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": "The question to answer using company knowledge."
},
"mode": {
"type": "string",
"enum": ["fast", "standard", "deep"],
"description": "Retrieval depth. 'fast' for quick lookups, 'standard' for most queries, 'deep' for cross-document synthesis. Defaults to 'standard'."
},
"max_sources": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Maximum number of source chunks to retrieve. Defaults to 5."
},
"domain": {
"type": "string",
"description": "Optional taxonomy domain to filter (e.g., 'engineering', 'finance')."
}
},
"required": ["question"]
}
}
}```### Executor (TypeScript)
```typescript// When the LLM calls the tool, execute it against Quelvio's REST API.
// The same handler works for OpenAI, Anthropic, and Mistral — only the
// tool-definition wrapper differs between providers.
async function executeQuelvioTool(args: {
question: string;
mode?: "fast" | "standard" | "deep";
max_sources?: number;
domain?: string;
}) {
const response = await fetch("https://api.quelvio.com/v1/enterprise/query", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.QUELVIO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: args.question,
mode: args.mode ?? "standard",
limit: args.max_sources ?? 5,
domain_filter: args.domain,
}),
});
if (!response.ok) {
throw new Error(`Quelvio query failed: ${response.status} ${response.statusText}`);
}
const data = await response.json();
return formatAnswerWithCitations(data);
}```### Executor (Python)
```python# When the LLM calls the tool, execute it against Quelvio's REST API.
# The same handler works for OpenAI, Anthropic, and Mistral — only the
# tool-definition wrapper differs between providers.
import os
import httpx
def execute_quelvio_tool(args: dict) -> dict:
response = httpx.post(
"https://api.quelvio.com/v1/enterprise/query",
headers={
"Authorization": f"Bearer {os.environ['QUELVIO_API_KEY']}",
"Content-Type": "application/json",
},
json={
"query": args["question"],
"mode": args.get("mode", "standard"),
"limit": args.get("max_sources", 5),
"domain_filter": args.get("domain"),
},
timeout=30.0,
)
response.raise_for_status()
return format_answer_with_citations(response.json())```Wire executeQuelvioTool into your tool_calls handler — when the model returns a tool_calls array, route entries with function.name === "quelvio_query" to it, feed the result back as a role: "tool" message, and re-call chat.completions.create.
## Anthropic tool use
Anthropic's tool-use API expects each tool as a { name, description, input_schema } object passed to messages.create via the tools parameter. The input_schema is a JSON Schema — the shape mirrors OpenAI's parameters, but the wrapper field names differ.
### Tool definition
```json{
"name": "quelvio_query",
"description": "Query the company's authority-scored, lifecycle-aware knowledge brain. Returns cited answers with provenance. Use when the user asks about internal company knowledge.",
"input_schema": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": "The question to answer using company knowledge."
},
"mode": {
"type": "string",
"enum": ["fast", "standard", "deep"]
},
"max_sources": {
"type": "integer",
"minimum": 1,
"maximum": 50
},
"domain": {
"type": "string"
}
},
"required": ["question"]
}
}```The execution code is identical to the OpenAI snippet above — only the tool-definition wrapper changes between providers. When Claude returns a tool_use content block, dispatch its input to the same executeQuelvioTool function and reply with a tool_result block carrying the formatted answer.
## Mistral function calling
Mistral's function-calling API is OpenAI-compatible — the same { type: "function", function: { name, description, parameters } } wrapper, the same tool_calls response shape on client.chat.complete. The OpenAI spec above can be reused verbatim.
### Tool definition
```json{
"type": "function",
"function": {
"name": "quelvio_query",
"description": "Query the company's authority-scored, lifecycle-aware knowledge brain. Returns cited answers with provenance. Use when the user asks about internal company knowledge (policies, runbooks, decisions, documentation, project status).",
"parameters": {
"type": "object",
"properties": {
"question": {
"type": "string",
"description": "The question to answer using company knowledge."
},
"mode": {
"type": "string",
"enum": ["fast", "standard", "deep"],
"description": "Retrieval depth. 'fast' for quick lookups, 'standard' for most queries, 'deep' for cross-document synthesis. Defaults to 'standard'."
},
"max_sources": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Maximum number of source chunks to retrieve. Defaults to 5."
},
"domain": {
"type": "string",
"description": "Optional taxonomy domain to filter (e.g., 'engineering', 'finance')."
}
},
"required": ["question"]
}
}
}```Quirk to watch for: Mistral expects each tool call's result to come back as a message with role: "tool" and a stringified JSON content. If you JSON-stringify Quelvio's response before feeding it back, you're fine; if you pass an object, Mistral will reject the request.
## Raw vs framework SDK
Raw function-calling and a framework SDK are different trade-offs, not different paths to the same outcome. Pick by which set of concerns you'd rather own yourself.
| When | What wins |
|---|---|
| Raw function-calling | Tight bundle size, full control over the agent loop, no framework dependency to track, custom orchestration patterns, single-provider apps where you don't need provider abstraction. |
| Framework SDK | Built-in retry and error handling, conversation memory and message-history management, multi-tool composition, less boilerplate, easier to swap providers, ecosystem of pre-built integrations. |
### Framework SDKs
- -[LangChain Python](https://pypi.org/project/quelvio-langchain):
pip install quelvio-langchain - -[LangChain JS](https://www.npmjs.com/package/@quelvio/langchain):
npm install @quelvio/langchain - -[LlamaIndex](https://pypi.org/project/llama-index-retrievers-quelvio):
pip install llama-index-retrievers-quelvio - -[Vercel AI SDK](https://www.npmjs.com/package/@quelvio/vercel-ai-sdk):
npm install @quelvio/vercel-ai-sdk - -[CrewAI](https://pypi.org/project/quelvio-crewai):
pip install quelvio-crewai
LlamaIndex, Vercel AI SDK, and CrewAI packages are forthcoming — links will resolve once they publish. LangChain Python and LangChain JS are live today.
## Links & references
- -[Quelvio for AI agents](https://quelvio.com/docs/ai-agents) (Use case): Per-agent quickstarts: Claude Code, Cursor, Codex, MCP
- -[Quelvio MCP server](https://quelvio.com/docs/mcp) (Reference): Same brain over Model Context Protocol — for GUI-resident agents
- -[Quelvio CLI](https://quelvio.com/docs/cli) (Reference): Same brain from the terminal — for shell-driven agents and CI
- -[OpenAPI specification](https://api.quelvio.com/openapi.json) (REST API): Full schema for /v1/enterprise/query, including error codes and rate-limit headers
- -[Account & API keys](https://enterprise.quelvio.com/account) (Dashboard): Generate Personal Access Tokens for QUELVIO_API_KEY at enterprise.quelvio.com/account
## Related
- -
- -