Skip to main content

Gentoro Python SDK for AI tool execution and authentication

Project description

Gentoro Python SDK

Overview

Welcome to the Gentoro Python SDK documentation. This guide will help you integrate and use the SDK in your project.

Supported Python Versions

This SDK is compatible with Python >= 3.7.

Installation

To get started with the SDK, install it using pip:

pip install Gentoro==0.1.6

Authentication

The Gentoro API uses an API Key (X-API-Key) for authentication. You must provide this key when making API requests.

To obtain an API Key, register at Gentoro's API Portal.

Setting the API Key

When initializing the SDK, provide the configuration as follows:

import os
from dotenv import load_dotenv
from Gentoro import Gentoro, SdkConfig, Providers

# Load environment variables
load_dotenv()

# Initialize SDK configuration
config = SdkConfig(
    base_url=os.getenv("GENTORO_BASE_URL"),
    api_key=os.getenv("GENTORO_API_KEY"),
    provider=Providers.OPENAI,
)

# Create an instance of the SDK
gentoro_instance = Gentoro(config)
bridge_uid = os.getenv("GENTORO_BRIDGE_UID")

# Fetch available tools
def get_tools():
    tools = gentoro_instance.get_tools(bridge_uid)
    print("Available tools:", tools)
    return tools

# Run a tool
def run_tool():
    tool_calls = [
        {
            "id": "1",
            "type": "function",
            "details": {
                "name": "say_hi",
                "arguments": {"name": "User_name"}
            }
        }
    ]
    result = gentoro_instance.run_tools(bridge_uid, messages=[], tool_calls=tool_calls)
    print("Tool execution result:", result)
    return result
if __name__ == "__main__":
    print("Fetching available tools...")
    get_tools()
    
    print("\nExecuting tool...")
    run_tool()
    

SDK Services

Methods

get_tools(bridge_uid: str, messages: Optional[List[Dict]] = None) -> List[Dict]

Fetches available tools for a specific bridge_uid.

Example usage:

tools = gentoro_instance.get_tools("BRIDGE_ID", messages=[])
print("Tools:", tools)

run_tools(bridge_uid: str, messages: List[Dict], tool_calls: List[Dict]) -> List[Dict]

Executes the tools requested by the AI model.

Example usage:

execution_result = gentoro_instance.run_tools("BRIDGE_ID", messages=[], tool_calls=tool_calls)
print("Execution Result:", execution_result)

Providers

A provider defines how the SDK should handle and generate content:

class Providers(str, Enum):
    OPENAI = "openai"
    ANTHROPIC = "anthropic"
    OPENAI_ASSISTANTS = "openai_assistants"
    VERCEL = "vercel"
    GENTORO = "gentoro"

License

This SDK is licensed under the Apache-2.0 License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Gentoro-0.1.6.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Gentoro-0.1.6-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file Gentoro-0.1.6.tar.gz.

File metadata

  • Download URL: Gentoro-0.1.6.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for Gentoro-0.1.6.tar.gz
Algorithm Hash digest
SHA256 45fb94150f306bb8a71164bc9312950fe11c1740f6b276b9afe3b14e44ba1956
MD5 7ca5f0ccfe178d7bcf8eab0bb0a031fd
BLAKE2b-256 8a8506adb69587177b015976120e52961e2712120d9aaee2e293098dc6562fce

See more details on using hashes here.

File details

Details for the file Gentoro-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: Gentoro-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for Gentoro-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ef9b29e51cda9e126b776d4ccfcceefdc9c3c072ee3836141fcea08a192b1934
MD5 af37bff516c2ff1b06b40e762af73242
BLAKE2b-256 e6638a9b449106f5789a66d0c86b7e8db3620505b4bc76b4e752aaccb9ba7348

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page