A package for generating function calls using OpenAI's API for ScaleGenAI's function calling models
Project description
Function-Calling-OpenAI-SDK
This package enhances the OpenAI Python SDK, enabling it to seamlessly integrate with ScaleGenAI's Llama-3 function calling models. It allows developers to easily incorporate advanced AI functionalities into their applications.
Getting Started
To use this package, you need to import CustomOpenAIClient from scalegen_function_calling and OpenAI from the openai package. Here's a quick example to get you started:
Usage
from scalegen_function_calling import CustomOpenAIClient
from openai import OpenAI
tools = [
{
"type":"function",
"function":{
"name":"Expense",
"description":"",
"parameters":{
"type":"object",
"properties":{
"description":{
"type":"string"
},
"net_amount":{
"type":"number"
},
"gross_amount":{
"type":"number"
},
"tax_rate":{
"type":"number"
},
"date":{
"type":"string",
"format":"date-time"
}
},
"required":[
"description",
"net_amount",
"gross_amount",
"tax_rate",
"date"
]
}
}
},
{
"type":"function",
"function":{
"name":"ReportTool",
"description":"",
"parameters":{
"type":"object",
"properties":{
"report":{
"type":"string"
}
},
"required":[
"report"
]
}
}
}
]
model_name = "ScaleGenAI/Llama3-70B-Function-Calling"
api_key = "<YOUR_API_KEY>"
api_endpint = "<YOUR_API_ENDPOINT>"
messages = [
{"role":"user", "content": 'I have spend 5$ on a coffee today please track my expense. The tax rate is 0.2. plz add to expense'}
]
client = OpenAI(
api_key=api_key,
base_url=api_endpoint,
)
custom_client = CustomOpenAIClient(client)
response = custom_client.chat.completions.create(
model=model_name,
messages=messages,
tools=tools,
stream=False
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scalegen_function_calling-0.1.8.tar.gz.
File metadata
- Download URL: scalegen_function_calling-0.1.8.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
966658121b697b8133edb00a6e6bda93c5750318734ba9b9c3d670dc29d5d1b8
|
|
| MD5 |
ebe0a918c291552d672be7a93264b5ec
|
|
| BLAKE2b-256 |
d5d6b96d85a017885b1a2105beffae5e1bd00ff9da0945d691dbaa77358c2b23
|
File details
Details for the file scalegen_function_calling-0.1.8-py3-none-any.whl.
File metadata
- Download URL: scalegen_function_calling-0.1.8-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed8d82a3735cb6b3179792652288203a21cecac99130d7e4a908698dd81ad3a3
|
|
| MD5 |
403a8b0a6047e67c5a5f776ba8723d4d
|
|
| BLAKE2b-256 |
900b318f8776b5912ae95f7176b5a69bb156ba3f95d13011b547361232899ef3
|