How to Utilize the Functionary Language Model

Category :

Welcome to the world of Functionary, a powerful language model developed to interpret and execute function calls effectively. Functionary intelligently determines when to execute functions, handles them in parallel or serially, and provides relevant grounded responses based on function outputs. In this guide, we will walk you through the process of using Functionary, its features, and how to troubleshoot common issues.

Key Features of Functionary

  • Intelligent Parallel Tool Use: Execute multiple functions simultaneously for efficient processing.
  • Output Analysis: Analyze outputs and provide responses grounded in those outputs.
  • Selective Function Calling: Determine when to call functions versus providing regular chat responses.
  • Open Source Alternative: A proud contender as one of the best open-source alternatives to GPT-4.

Performance Metrics

Functionary has achieved state-of-the-art performance in Function Calling Accuracy:


Dataset                        Model Name                                         Function Calling Accuracy (Name & Arguments)
-----------------------------   -------------------------------------------    ---------------------------------------
In-house data                  MeetKai-functionary-small-v2.2                   0.546
In-house data                  MeetKai-functionary-medium-v2.2                  **0.664**
In-house data                  OpenAI-gpt-3.5-turbo-1106                        0.531
In-house data                  OpenAI-gpt-4-1106-preview                         **0.737**

Understanding Functionary with an Analogy

Think of Functionary as an experienced chef running a busy kitchen. Each dish represents a function. The chef (Functionary) knows how to execute multiple dishes at once (parallel execution) and how each dish interacts with others. If a customer asks for a specific dish (function call), the chef assesses what ingredients (arguments) are necessary to create that dish and responds with the outcome based on the quality of the ingredients used (outputs). Furthermore, the chef sometimes decides that a regular meal suggestion (normal chat response) will suffice instead of preparing a dish.

How to Run the Model

To run the functionary model, follow these steps:

  1. Set up your environment by installing the necessary libraries, including the OpenAI-compatible vLLM server.
  2. Utilize the sample code provided, which formats message exchange using Python and the OpenAI client.

Your sample code is as follows:


from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="functionary")
response = client.chat.completions.create(
    model="pathtofunctionarymodel",
    messages=[{"role": "user", "content": "What is the weather for Istanbul?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_current_weather",
            "description": "Get the current weather",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city and state, e.g. San Francisco, CA"
                    }
                },
                "required": ["location"]
            }
        }
    }],
    tool_choice="auto"
)

Troubleshooting Tips

While using Functionary, you may encounter a few issues. Here are some troubleshooting ideas:

  • Common Errors: Check the function definitions in your JSON schema for syntax errors.
  • Model Not Responding: Ensure that your server is running and you are pointing to the right base URL.
  • Function Not Executing: Verify that your function logic is correctly formed and all parameters are provided.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

Functionary is an impressive tool that provides not only a robust alternative to existing models but also innovative solutions for leveraging function calling efficiently. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox

Latest Insights

© 2024 All Rights Reserved

×