NexusRaven-V2-13B: Surpassing GPT-4 for Zero-shot Function Calling

Jun 1, 2024 | Educational

Welcome to the world of advanced language models! Today, we’re uncovering the mystical capabilities of NexusRaven-V2-13B, an open-source large language model (LLM) that is pushing the boundaries of what models can do in function calling. Designed to change the way we interact with AI, NexusRaven can generate single function calls, nested calls, and even parallel calls with impressive reliability!

Why Choose NexusRaven-V2?

NexusRaven-V2 is a powerhouse of functionality:

  • Versatile Function Calling Capability: It excels at generating complex, nested, and parallel function calls.
  • Fully Explainable: NexusRaven provides detailed explanations for its function calls, though this feature can be toggled off to save on processing tokens.
  • Performance Highlights: Outpacing GPT-4 by 7% in success rates for function calling in real scenarios!
  • Generalization to the Unseen: NexusRaven performs well even on functions it has never encountered before.
  • Commercially Permissive: Deploy it for business with confidence, as it doesn’t use proprietary model data.

How to Get Started with NexusRaven-V2

Using NexusRaven-V2 is a breeze! Here’s a straightforward guide to kick-start your journey:

1. Setting Up the Model

Ensure you have the required libraries installed. You’ll want to use the transformers library to access the NexusRaven model.

pip install transformers accelerate

2. Running the Model

To execute the model, use the following code. Think of this as calling out to your friend for help: when you give them your situation (the prompt), they respond with exactly what you need based on the functions you’ve defined.

from transformers import pipeline
pipeline = pipeline(
    "text-generation",
    model="Nexusflow/NexusRaven-V2-13B",
    torch_dtype="auto",
    device_map="auto",
)

prompt_template = """Function:def get_weather_data(coordinates):
    Fetches weather data from the Open-Meteo API for the given latitude and longitude.
    Args:
        coordinates (tuple): The latitude of the location.
    Returns:
        float: The current temperature in the coordinates you've asked for
Function:def get_coordinates_from_city(city_name):
    Fetches the latitude and longitude of a given city name using the Maps.co Geocoding API.
    Args:
        city_name (str): The name of the city.
    Returns:
        tuple: The latitude and longitude of the city.
User Query: queryhuman_end"""

prompt = prompt_template.format(query="What's the weather like in Seattle right now?")
result = pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]['generated_text']
print(result)

Imagine asking your friend, “What’s the weather like in Seattle?” Based on the functions defined, the model first finds the coordinates of Seattle and then retrieves the weather for those coordinates seamlessly!

3. Utilizing the Output

The model will respond with a structured call, showing the functions being utilized to answer your query. It’s like unfolding a treasure map, revealing each step towards the answer.

Troubleshooting

If you encounter issues while implementing NexusRaven-V2, here are some tips:

  • Issue with Function Calls: Ensure that the functions provided to NexusRaven-V2 have arguments. It performs best when asked to work with functions that require input.
  • Performance Concerns: If the model appears to stall or produce errors, check if your code is properly formatted and follows the outlined structure.
  • Incorrect Output: Always double-check the arguments being passed into functions to avoid confusion.

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

Conclusion

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