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.10.

Installation

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

pip install Gentoro==0.1.7

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 Gentoro import Gentoro, SdkConfig, Providers
from dotenv import load_dotenv
import openai

# Load environment variables from .env file
load_dotenv()


# Initialize the Gentoro and OpenAI instances
_gentoro = Gentoro(SdkConfig(provider=Providers.OPENAI))
_openAI = openai.OpenAI()

# Define the OpenAI model we want to use
MODEL = 'gpt-4o-mini'

# Initial messages to OpenAI
messages = [{"role": "user", "content": "list 10 of my slack channels"}]

# Send message, along with available tools to OpenAI
openai_response = _openAI.chat.completions.create(
    model=MODEL,
    messages=messages,
    tools=_gentoro.get_tools(os.getenv("GENTORO_BRIDGE_UID"), messages)
)
messages += _gentoro.run_tools(os.getenv("GENTORO_BRIDGE_UID"), messages, openai_response)

# Continue with communication with OpenAI
response = _openAI.chat.completions.create(
  model=MODEL,
  messages=messages,
  tools=_gentoro.get_tools(os.getenv("GENTORO_BRIDGE_UID"), messages)
)

# Prints the response with the answer
print("final response",response.choices[0].message.content)
    

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.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.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:

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.7.tar.gz (11.3 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.7-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Gentoro-0.1.7.tar.gz
  • Upload date:
  • Size: 11.3 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.7.tar.gz
Algorithm Hash digest
SHA256 2511a8eae72fdec1b82604d61381c3be521f6bb4d974604d77a59f84a0532a91
MD5 5b7000b233820724f2ed640184098cec
BLAKE2b-256 8e90407404d2aa31d41f9a59458359bd3e691d9596367845c5e445ff64b8161a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Gentoro-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e0dd1bfc3ec4fcac5a07fe674c69eab1422cb28144aab8b034dd75717197fcea
MD5 2c203b53564150535789d20550d323f6
BLAKE2b-256 e1bf14f71ee1236fac07d8a762be732a38c897f2f6ac2853b1885374857a7243

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