gorilla README

The project's README from github.com/ShishirPatil/gorilla. As one markdown file: README.md.

Gorilla: Large Language Model Connected with Massive APIs

Arxiv Discord Gorilla Website Gorilla Blog Hugging Face

Latest Updates

📢 Check out our detailed Berkeley Function Calling Leaderboard changelog (Last updated: Last Updated) for the latest dataset / model updates to the Berkeley Function Calling Leaderboard!

About

Gorilla enables LLMs to use tools by invoking APIs. Given a natural language query, Gorilla comes up with the semantically- and syntactically- correct API to invoke.

With Gorilla, we are the first to demonstrate how to use LLMs to invoke 1,600+ (and growing) API calls accurately while reducing hallucination. This repository contains inference code for running Gorilla finetuned models, evaluation code for reproducing results from our paper, and APIBench - the largest collection of APIs, curated and easy to be trained on!

Since our initial release, we've served ~500k requests and witnessed incredible adoption by developers worldwide. The project has expanded to include tools, evaluations, leaderboard, end-to-end finetuning recipes, infrastructure components, and the Gorilla API Store:

Project Type Description (click to expand)
Gorilla Paper 🤖 Model
📝 Fine-tuning
📚 Dataset
📊 Evaluation
🔧 Infra
Large Language Model Connected with Massive APIs• Novel finetuning approach for API invocation
• Evaluation on 1,600+ APIs (APIBench)
• Retrieval-augmented training for test-time adaptation
Gorilla OpenFunctions-V2 🤖 Model
Drop-in alternative for function calling, supporting multiple complex data types and parallel execution• Multiple & parallel function execution with OpenAI-compatible endpoints
• Native support for Python, Java, JavaScript, and REST APIs with expanded data types
• Function relevance detection to reduce hallucinations
• Enhanced RESTful API formatting capabilities
• State-of-the-art performance among open-source models
Berkeley Function Calling Leaderboard (BFCL) 📊 Evaluation
🏆 Leaderboard
🔧 Function Calling Infra
📚 Dataset
Comprehensive evaluation of function-calling capabilities• V1: Expert-curated dataset for evaluating single-turn function calling
• V2: Enterprise-contributed data for real-world scenarios
• V3: Multi-turn & multi-step function calling evaluation
• Cost and latency metrics for all models
• Interactive API explorer for testing
• Community-driven benchmarking platform
Agent Arena 📊 Evaluation
🏆 Leaderboard
Compare LLM agents across models, tools, and frameworks• Head-to-head agent comparisons with ELO rating system
• Framework compatibility testing (LangChain, AutoGPT)
• Community-driven evaluation platform
• Real-world task performance metrics
Gorilla Execution Engine (GoEx) 🔧 Infra
Runtime for executing LLM-generated actions with safety guarantees• Post-facto validation for verifying LLM actions after execution
• Undo capabilities and damage confinement for risk mitigation
• OAuth2 and API key authentication for multiple services
• Support for RESTful APIs, databases, and filesystem operations
• Docker-based sandboxed execution environment
Retrieval-Augmented Fine-tuning (RAFT) 📝 Fine-tuning
🤖 Model
Fine-tuning LLMs for robust domain-specific retrieval• Novel fine-tuning recipe for domain-specific RAG
• Chain-of-thought answers with direct document quotes
• Training with oracle and distractor documents
• Improved performance on PubMed, HotpotQA, and Gorilla benchmarks
• Efficient adaptation of smaller models for domain QA
Gorilla CLI 🤖 Model
🔧 Local CLI Infra
LLMs for your command-line interface• User-friendly CLI tool supporting ~1500 APIs (Kubernetes, AWS, GCP, etc.)
• Natural language command generation with multi-LLM fusion
• Privacy-focused with explicit execution approval
• Command history and interactive selection interface
Gorilla API Zoo 📚 Dataset
A community-maintained repository of up-to-date API documentation• Centralized, searchable index of APIs across domains
• Structured documentation format with arguments, versioning, and examples
• Community-driven updates to keep pace with API changes
• Rich data source for model training and fine-tuning
• Enables retrieval-augmented training and inference
• Reduces hallucination through up-to-date documentation

Getting Started

Quick Start

Try Gorilla in your browser:

Installation Options

  1. Gorilla CLI - Fastest way to get started
pip install gorilla-cli
gorilla generate 100 random characters into a file called test.txt

Learn more about Gorilla CLI →

  1. Run Gorilla Locally
git clone https://github.com/ShishirPatil/gorilla.git
cd gorilla/inference

Detailed local setup instructions →

  1. Use OpenFunctions
import openai

openai.api_key = "EMPTY"
openai.api_base = "http://luigi.millennium.berkeley.edu:8000/v1"

# Define your functions
functions = [{
    "name": "get_current_weather",
    "description": "Get weather in a location",
    "parameters": {
        "type": "object",
        "properties": {
            "location": {"type": "string"},
            "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
        },
        "required": ["location"]
    }
}]

# Make API call
completion = openai.ChatCompletion.create(
    model="gorilla-openfunctions-v2",
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
    functions=functions
)

OpenFunctions documentation →

🔧 Other Quick Starts

Frequently Asked Questions

  1. I would like to use Gorilla commercially. Is there going to be an Apache 2.0 licensed version?

Yes! We now have models that you can use commercially without any obligations.

  1. Can we use Gorilla with other tools like Langchain etc?

Absolutely! You've highlighted a great aspect of our tools. Gorilla is an end-to-end model, specifically tailored to serve correct API calls (tools) without requiring any additional coding. It's designed to work as part of a wider ecosystem and can be flexibly integrated within agentic frameworks and other tools.

Langchain, is a versatile developer tool. Its "agents" can efficiently swap in any LLM, Gorilla included, making it a highly adaptable solution for various needs.

The beauty of these tools truly shines when they collaborate, complementing each other's strengths and capabilities to create an even more powerful and comprehensive solution. This is where your contribution can make a difference. We enthusiastically welcome any inputs to further refine and enhance these tools.

Check out our blog on How to Use Gorilla: A Step-by-Step Walkthrough to see all the different ways you can integrate Gorilla in your projects.

Project Roadmap

In the immediate future, we plan to release the following:

License

Gorilla is Apache 2.0 licensed, making it suitable for both academic and commercial use.

Contact

Citation

@article{patil2023gorilla,
  title={Gorilla: Large Language Model Connected with Massive APIs},
  author={Shishir G. Patil and Tianjun Zhang and Xin Wang and Joseph E. Gonzalez},
  year={2023},
  journal={arXiv preprint arXiv:2305.15334},
} 

gorilla (ShishirPatil/gorilla)

Searching Database…

13.1K ·GitHub
这是什么?Gorilla 是伯克利大学的一个研究项目,用于训练和评估大语言模型(LLM),使其能根据自然语言请求正确调用 API 和工具。它已发展成一套项目,包括经过微调的模型(OpenFunctions)、伯克利函数调用排行榜(BFCL)、执行运行时(GoEx)、RAG 微调方案(RAFT)以及一个命令行工具。
这是一个工具,还是一组相关项目?这是一个伞形仓库,包含几个相互独立但彼此关联的项目:Gorilla/OpenFunctions 模型、BFCL 基准测试与排行榜、GoEx 执行运行时、RAFT 微调方案、Gorilla CLI,以及 API Zoo 数据集。
不装任何东西,我怎么试用?你可以通过浏览器中托管的 Colab 和 Gradio 演示试用基础版 Gorilla 模型和 OpenFunctions,也可以在本地安装 Gorilla CLI,以最快的方式动手体验。
GoEx 要用我自己的 API 密钥,才能真正执行 Gorilla 生成的调用吗?需要。GoEx 是执行 LLM 生成动作的运行时,在执行调用之前,它会通过 OAuth2 或 API 密钥自行向目标服务进行身份验证。
用它构建真正的智能体,还是得配合 LangChain 之类的框架吗?Gorilla 只负责为请求生成正确的 API 调用,本身不运行智能体循环,因此它是设计为接入 LangChain 等智能体框架的,而不是用来取代它们。
可以免费用于商业用途吗?可以。整个项目(包括已发布的 Gorilla 和 OpenFunctions 模型)采用 Apache 2.0 许可证,学术和商业场景都能使用,无需额外承担义务。
什么是伯克利函数调用排行榜(BFCL)?它是一个全面的、由社区驱动的基准测试和排行榜,用于比较各模型在单轮、多轮和多步场景下的函数调用能力,同时包含成本和延迟指标。
GoEx 到底是做什么的?GoEx 是一个用于安全执行 LLM 生成动作(如 API 调用和代码)的运行时,提供事后验证以及撤销和损害限制机制,以降低自主智能体出错的风险。
什么是 RAFT?RAFT(检索增强微调)是一套针对特定领域、基于检索增强生成(RAG)对 LLM 进行微调的方案。训练时使用含答案的文档和干扰文档,并配以直接引用源文档的思维链式回答。
Gorilla CLI 除了调用网络 API,还能处理云基础设施命令之类的事情吗?可以。Gorilla CLI 能把自然语言转换为约 1,500 个 API 的命令,包括 Kubernetes、AWS 和 GCP,并且在运行任何命令前都需要用户明确批准。
What are similar projects?NeoHorse, imp, minimind, RSIGame, CLM, Raven, rrsi, XRAG
Size
370.8 MB
Stars
13.1K
Age
3y
Commits · 90 Days