Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 24, 2026·3 min de lecture

Gorilla — LLM That Writes Accurate API Calls

Gorilla is a fine-tuned LLM from UC Berkeley that generates correct API calls with reduced hallucination. It connects language models to thousands of real-world APIs and tools.

assetLangBanner.body

Introduction

Gorilla is a research project from UC Berkeley that fine-tunes LLMs to generate accurate, executable API calls. Instead of hallucinating function signatures or parameters, Gorilla models are trained against real API documentation, producing calls that match current library versions.

What Gorilla Does

  • Generates syntactically correct API calls for Hugging Face, PyTorch, TensorFlow, and more
  • Provides a CLI tool that translates natural language into shell commands
  • Includes APIBench, a benchmark of over 16,000 real API entries for evaluation
  • Reduces API hallucination compared to base models like GPT-4
  • Supports retrieval-augmented generation to stay current with API changes

Architecture Overview

Gorilla fine-tunes a base LLM on a curated dataset of API documentation and usage examples. During inference, it can optionally retrieve up-to-date API docs from a document store before generating the call, which helps handle version changes. The CLI wrapper intercepts natural language queries, passes them through the model, and presents the generated command for user confirmation before execution.

Self-Hosting & Configuration

  • Install the CLI via pip for quick command-line translation
  • Run the full Gorilla model locally using any Hugging Face-compatible serving framework
  • Configure API documentation retrieval by pointing to your own doc corpus
  • Set the preferred model backend (OpenAI API or local inference) via environment variables
  • APIBench datasets can be extended with your organization's internal API documentation

Key Features

  • Trained on real API documentation, not synthetic examples
  • CLI mode converts plain English to shell commands with confirmation prompts
  • Retrieval mode keeps API calls current as libraries release new versions
  • APIBench provides a standardized evaluation framework for API generation
  • Open weights allow self-hosted deployment without external API dependencies

Comparison with Similar Tools

  • OpenAI function calling — built into GPT models but less specialized; no retrieval for versioned APIs
  • ToolLLM — similar API-calling focus but different training corpus and approach
  • NexusRaven — function-calling LLM; narrower scope without CLI tooling
  • ShellGPT — translates to shell commands but does not specialize in API call accuracy

FAQ

Q: Which APIs does Gorilla support? A: The training set includes Hugging Face, PyTorch Hub, TensorFlow Hub, and a growing list of tool APIs. You can extend it with custom documentation.

Q: Can I run Gorilla locally? A: Yes. The model weights are available on Hugging Face and can be served with vLLM, llama.cpp, or any compatible inference engine.

Q: How does retrieval-augmented mode work? A: Gorilla retrieves the latest API documentation at inference time, so generated calls match the current library version rather than the version seen during training.

Q: Is the CLI safe to use? A: The CLI always shows the generated command and asks for confirmation before executing anything.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires