Skip to main content

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
        )

Metadata

Release files for scalegen-function-calling 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scalegen-function-calling 0.1.8
File Size Uploaded Provenance Actions
scalegen_function_calling-0.1.8.tar.gz 12.8 kB Without provenance Details for scalegen_function_calling-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scalegen-function-calling 0.1.8
File Interpreter ABI Platform Actions
scalegen_function_calling-0.1.8-py3-none-any.whl Python 3 none any Details for scalegen_function_calling-0.1.8-py3-none-any.whl

Total release size: 27.4 kB

Release files / scalegen_function_calling-0.1.8.tar.gz

Download URL scalegen_function_calling-0.1.8.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
966658121b697b8133edb00a6e6bda93c5750318734ba9b9c3d670dc29d5d1b8
BLAKE2b-256 checksum
How to use checksums
d5d6b96d85a017885b1a2105beffae5e1bd00ff9da0945d691dbaa77358c2b23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release files / scalegen_function_calling-0.1.8-py3-none-any.whl

Download URL scalegen_function_calling-0.1.8-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed8d82a3735cb6b3179792652288203a21cecac99130d7e4a908698dd81ad3a3
BLAKE2b-256 checksum
How to use checksums
900b318f8776b5912ae95f7176b5a69bb156ba3f95d13011b547361232899ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Security for scalegen-function-calling 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page