RacoGPT_light_function_calling Usage Guide
Introduction
RacoGPT_light_function_calling is a Hugging Face model trained on a comprehensive general knowledge dataset, with advanced function-calling capabilities, making it compatible with the RacoGPT library for enriched API interaction. This guide will show you how to perform function-calling using the model.
Getting Started
To utilize the function-calling capabilities of the RacoGPT_light model, follow these steps:
Step 1: Install the RacoGPT Library
If you haven't already, install the RacoGPT library via pip:
pip install RacoGPT
Step 2: Setting Up the RacoGPT Client
Import the RacoGPTClient
from the RacoGPT
library, configure the client with the correct host, and specify the model.
from racogpt import RacoGPTClient
client = RacoGPTClient(host="http://localhost:11434", model="carlo")
Example 1: Simple Completion (without Function Calling)
prompt = "What's the weather like today?"
print("Simple Completion Request:", prompt)
response = client.simple_completion(prompt)
print("
Simple Completion Response:", response)
Output:
Simple Completion Response: I'm a large language model, I don't have real-time access to current weather conditions. However, I can suggest some ways for you to find out the current weather:
1. Check online weather websites: You can visit websites such as AccuWeather, Weather.com, or the National Weather Service (NWS) for current and forecasted weather conditions.
2. Use a mobile app: There are many weather apps available for both iOS and Android devices that provide real-time weather information.
3. Ask a voice assistant: If you have a smart speaker or virtual assistant like Siri, Alexa, or Google Assistant, they can often provide the current weather.
If you'd like to give me some general information about the weather, I can try to help!
Example 2: Function Calling Completion
query = "Where can I find discounted deals on popular video games?"
print("
Function Calling Completion Request:", query)
tools = [{
"name": "fetch_game_deals",
"description": "Retrieve current discounted game deals from the Deals API based on the specified platform and genre.",
"parameters": {
"platform": {
"description": "The platform for which to retrieve deals (e.g., PC, PS5, Xbox).",
"type": "str",
"default": "PC"
},
"genre": {
"description": "The genre of games to filter the deals (e.g., RPG, action, sports).",
"type": "str",
"default": "action"
}
}
}]
response = client.function_calling_completion(query=query, tools=tools)
print("
Function Calling Completion Response:", response)
Output:
Function Calling Completion Response: [{'name': 'fetch_game_deals', 'arguments': {'platform': 'PC', 'genre': 'RPG'}}, {'name': 'fetch_game_deals', 'arguments': {'platform': 'PS5', 'genre': 'Action'}}]
Example 3: Auto Completion with Specified Tools
query = "Where can I find live gaming events near me?"
print("
Auto Completion Request with tools:", query)
tools = [{
"name": "fetch_live_events",
"description": "Retrieve current live gaming events based on location and game type.",
"parameters": {
"location": {
"description": "Location to search for events (e.g., city or country).",
"type": "str",
"default": "New York"
},
"game_type": {
"description": "The type of game events to retrieve (e.g., eSports, LAN parties).",
"type": "str",
"default": "eSports"
}
}
}]
response = client.auto_completion(query=query, tools=tools)
print("
Auto Completion Response:", response)
Output:
Auto Completion Response: [{'name': 'fetch_live_events', 'arguments': {'location': 'New York', 'game_type': 'eSports'}}]
Example 4: Auto Completion without Specified Tools
prompt = "How can I learn Python programming?"
print("
Auto Completion Request without tools:", prompt)
response = client.auto_completion(prompt)
print("
Auto Completion Response:", response)
Output:
Auto Completion Response: **Learning Python Programming**
Python is a high-level, interpreted language that is widely used for various purposes such as web development, data analysis, artificial intelligence, and more. Here's how you can learn Python:
### 1. Online Courses and Tutorials
* Codecademy (interactive coding environment): Learn by creating projects, quizzes, and challenges.
* DataCamp: Interactive courses on various topics, including Python, data science, and machine learning.
* Coursera, edX, and Udemy: Offer a wide range of Python courses from top universities.
### 2. Tutorials and Guides
* Official Python documentation (docs.python.org): Get started with the basics, syntax, and built-in libraries.
* W3Schools' Python Tutorial: A comprehensive tutorial covering various topics, including variables, data types, functions, and more.
* Real Python: An online community-driven resource for learning Python.
### 3. Practice with Projects
* Start with simple projects, such as:
+ Calculating the sum of squares or cubes
+ Building a calculator program
+ Creating a simple game (e.g., Tic-Tac-Toe)
* Use platforms like LeetCode, HackerRank, and Project Euler to practice your skills.
### 4. Books
* "Python Crash Course" by Eric Haelterman: A comprehensive book covering Python fundamentals.
* "Automate the Boring Stuff with Python" by Al Sweigart: A hands-on guide for automation tasks.
* "Learning Python" by Mark Lutz and Fredrik Suttie: A detailed textbook on Python.
### 5. Join Online Communities
* Reddit's r/learnpython community: Share your knowledge, ask questions, and discuss various topics.
* Stack Overflow (stackoverflow.com): Ask and answer programming questions related to Python.
### 6. Watch Tutorials
* YouTube channels like:
+ Corey Schafer's Python Tutorials
+ Traversy Media's Python Programming Channel
+ Py4Fun's Python tutorials
**7. Take Online Certifications**
* CompTIA A: Covers basic concepts, data types, and file I/O.
* Google Cloud Certified - Professional Developer: Learn about cloud computing with Python.
**8. Find a Mentor or Join a Coding Group**
* Connect with experienced Python programmers on platforms like GitHub, LinkedIn, or Stack Overflow.
* Participate in coding groups, such as hackathons, meetups, and online forums.
Remember, learning Python requires patience, persistence, and practice. Start with the basics, build projects, and gradually move to more complex topics. Good luck!
Example 5: Full Completion with Tools
messages = [
{"role": "user", "content": "Where can I find discounted deals on video games?"},
{"role": "assistant", "content": "You can find deals on sites like Steam and GOG."},
{"role": "user", "content": "I need information on PC game deals."}
]
tools = [
{
"name": "fetch_game_deals",
"description": "Retrieve current discounted game deals from the Deals API based on the specified platform and genre.",
"parameters": {
"platform": {
"description": "The platform for which to retrieve deals (e.g., PC, PS5, Xbox).",
"type": "str",
"default": "PC"
},
"genre": {
"description": "The genre of games to filter the deals (e.g., RPG, action, sports).",
"type": "str",
"default": "action"
}
}
}
]
response = client.full_completion(messages, tools=tools)
print("
Full Completion with Tools Response:", response)
Output:
Full Completion with Tools Response: "The given question lacks the parameters required by the function."
By following these examples, you'll be well-equipped to leverage RacoGPT_light_function_calling's capabilities for general knowledge querying and function calling within the RacoGPT library. Enjoy experimenting with different prompts and toolsets to fully explore the model's functionalities!
- Downloads last month
- 0
Model tree for Francesco26061993/RacoGPT_light_function_calling
Base model
meta-llama/Llama-3.2-1B-InstructEvaluation results
- Training Accuracy on ShareGPT UncensoredHugging Face Model Card85.500