Skip to content
Back to skills

Liter Llm Tool Calling

ASecurity

Use when defining functions/tools for an LLM to call through liter-llm, or requesting structured JSON outputs. Covers tool schemas, tool_calls handling, and response formats.

  • 269 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
developmentpythonapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add kreuzberg-dev/liter-llm --skill liter-llm-tool-calling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Liter Llm Tool Calling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Liter Llm Tool Calling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kreuzberg-dev-liter-llm-tool-calling-liter-llm/badge)](https://www.skillsdirectory.com/skills/kreuzberg-dev-liter-llm-tool-calling-liter-llm)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Use when defining functions/tools for an LLM to call through liter-llm, or requesting structured JSON outputs. Covers tool schemas, tool_calls handling, and response formats.
name: liter-llm-tool-calling
---

<!--
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
Content-Hash: blake3:f26049693a8fa3229f675eefc4097cfa0aeb669a5744967a7ab3614009a80310
Source-Hash: blake3:1d13596a9423e4b9d7275b656852a3ec55becf932ea6489140c09e4ee9471c92
Schema-Version: v1
-->

# Tool Calling

Pass a `tools` array of function definitions; the model may respond with
`tool_calls` instead of (or alongside) text. Execute the named function and feed
the result back as a `tool` message.

## Python

```python
import asyncio, json, os
from liter_llm import create_client
from liter_llm._internal_bindings import ChatCompletionRequest

payload = {
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "What is the weather in Berlin?"}],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get the current weather for a location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {"type": "string", "description": "City name"},
                    },
                    "required": ["location"],
                },
            },
        }
    ],
    "tool_choice": "auto",
}

async def main() -> None:
    client = create_client(api_key=os.environ["OPENAI_API_KEY"])
    request = ChatCompletionRequest.from_json(json.dumps(payload))
    response = await client.chat(request)
    for call in response.choices[0].message.tool_calls or []:
        print(call.function.name, call.function.arguments)  # arguments is a JSON string

asyncio.run(main())
```

## Structured outputs

Request strict JSON with `response_format`:

```python
request = ChatCompletionRequest.from_json(json.dumps({
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Extract name and age as JSON."}],
    "response_format": {"type": "json_object"},
}))
response = await client.chat(request)
```

## Notes

- `function.arguments` is a JSON **string** — parse it before use.
- Append each tool result as a message with `role="tool"` and the matching
  `tool_call_id`, then call `chat` again to let the model continue.
- Tool support and JSON-mode availability vary by provider; check the provider
  reference if a model ignores `tools`.

Files in this skill

  • SKILL.md2.5 KB
  • index.md459 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.