Skip to main content

A module for integrating various GPT models for diverse tasks.

Project description

PyPI version License: MIT Downloads

GPTIntegration

GPTIntegration is a Python module for integrating GPT models from OpenAI into your projects. It simplifies querying GPT models by handling the setup, communication, and response parsing with the OpenAI API, enabling easy integration and efficient interaction with GPT models.

Installation

To install GPTIntegration, you can use pip:

pip install GPTIntegration

Usage

As a Python Module

You can use GPTIntegration as a module in your Python scripts.

Example:

from gptintegration import GPTIntegration

# Initialize the integration with your OpenAI API key
gpt_integration = GPTIntegration('your-openai-api-key')

# Prepare messages
system_message = "Your system message goes here."
user_messages = ["Your prompt or user message goes here."]

# Query GPT and get the response
response = gpt_integration.query_gpt(system_message, user_messages)
print(response)

Customizing Your Query

You can customize your query by adjusting the initialization parameters of the GPTIntegration class, such as model, temperature, max tokens, and others to fit the specific needs of your application or to tweak the behavior of the GPT model.

Output Example

When you query GPT using GPTIntegration, it sends the system and user messages to the specified GPT model and returns the model's response. Here is an example output:

{
    "id": "example-response-id",
    "object": "text_completion",
    "created": 123456789,
    "model": "gpt-3.5-turbo",
    ...,
    "choices": [
        {
            "text": "Response from the GPT model based on the provided messages...",
            "index": 0,
            "logprobs": null,
            "finish_reason": "length"
        }
    ]
}

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues page.

License

MIT

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

GPTIntegration-0.0.4.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

GPTIntegration-0.0.4-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

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