A flexible and powerful Python library for interacting with various AI language models
Project description
ChatFusion ⚡
A flexible and powerful Python library for interacting with various AI language models, including OpenAI's GPT and Google's Gemini.
Features
- Support for multiple AI providers (OpenAI and Google Gemini and more coming) as well as capability of adding your own
- Easy-to-use API for generating responses
- Flexible prompt system supporting both single-message and chat-based interactions immutable data structure
- Handling of text and file inputs
- Streaming support for real-time responses
- Customizable generation parameters
Installation
pip install chatfusion
and install the AI libraries you plan on using, for now google-generativeai and openai have built in support
Usage
from chatfusion import configure, GeneratorFactory, Prompt
configure(gemini_api_key="YOUR_API_KEY", openai_api_key= 'YOUR_API_KEY')
factory = GeneratorFactory()
gemini_model = factory.create_generator(model_name='gemini-1.5-pro-latest')
gpt_4o = factory.create_generator(model_name='gpt-4o-mini')
prompt = Prompt().text('Hi, how are you?')
response = gemini_model.generate_response(prompt)
print(response.text())
response = gpt_4o.generate_response(prompt)
print(response.text())
prompt = Prompt().chat().system('Your name is mason')
prompt = prompt.user('whats your name?')
response = gemini_model.generate_response(prompt)
print(response.text())
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chatfusion-0.0.2.tar.gz
(11.1 kB
view details)
Built Distribution
File details
Details for the file chatfusion-0.0.2.tar.gz
.
File metadata
- Download URL: chatfusion-0.0.2.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04b1b45d68cf6825432dba05b69364b59017e604a3aa86c84905740f483c27a8 |
|
MD5 | 698780dab8d4c44b63d49e81eae14fbc |
|
BLAKE2b-256 | 02b827d399ea6f6672ec094c5822d3bb642c29be8cb3ebac66b5f8026485f01a |
File details
Details for the file chatfusion-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: chatfusion-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b27012925dfc24c035258da4b3537838581b84852d3e4d883953aca9a88a2c6 |
|
MD5 | 0ce0763801fdaa2ad3ff5016a37b18c4 |
|
BLAKE2b-256 | 053eedb110f1486f04b28397fc8a05f070115604bea802c6575a046e885116af |