Skip to main content

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


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.1.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

chatfusion-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file chatfusion-0.1.0.tar.gz.

File metadata

  • Download URL: chatfusion-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for chatfusion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a64d318f301835ab927ada76539e2431fcc7fb2a51762ebcca35fc3a103d89e
MD5 1b7249378827d6f665f0d21e4cbb7eb7
BLAKE2b-256 d2c05a2d4d2581883833c46e7e609465196d17d8021bf651e5c7edc407a430e9

See more details on using hashes here.

File details

Details for the file chatfusion-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatfusion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for chatfusion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d8f45afb698a624e75b9674e17774e8e2ef2e0c557c7444debf2f6d1d7a6c94
MD5 60e7c7687b2829826dc0d06e79790ffd
BLAKE2b-256 9352040ea744fd121e6b1b123e9443fa19dac6e1547ad31f62f4ddb1151e7ccf

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