Beyond our REST API, we also provide a Python SDK with examples in our cookbooks to aid your development process.
Getting Started With the SDK
Like many good things, working with our SDK first starts with an installation. Run this command in a terminal of your choice to start the installation of the library on your device:
pip install customgpt-client
Getting to Work
Once your installation is complete, you are ready to develop. As a first step, we recommend checking out our cookbooks for examples on how to interact with the SDK. Here you'll find a variety of samples demonstrating how to utilize our SDK for tasks ranging from simple requests to complex integrations.
Why Use the SDK?
If you are new to developing and want to simplify your work, our SDK provides a straightforward and powerful way to integrate CustomGPT capabilities into your applications. Here are a few reasons to use the SDK:
- Simplified Coding: Reduce the amount of code you need to write and maintain. Our SDK handles the complexities of network calls and data serialization for you.
- Enhanced Features: Take advantage of enhanced features not always available through the REST API, like session management and asynchronous calls.
- Community and Support: Gain access to a community of developers and receive support through our dedicated forums and technical support channels.
Integration Examples
To help you get started, here are some basic examples of how to use our SDK:
Basic Usage
from customgpt_client import CustomGPT
import uuid
# Set API key
CustomGPT.api_key = "API_KEY"
# Create session ID
session_id = uuid.uuid4()
# Send conversation
stream_response = CustomGPT.Conversation.send(
project_id="<PROJECT_ID>",
session_id=session_id,
prompt="Who is Tom Brady? Answer in 10 words only"
)
answer = stream_response.parsed.data.openai_response
print("Response:", answer)
You can get more SDK code examples here
Next Steps
After experimenting with these initial examples, dive deeper into the capabilities of the SDK by exploring advanced features such as batch requests, custom completions, and fine-tuning your models. Check out our detailed guides and API documentation in the developer section of our website.