Skip to main content

Facilitates interaction with API LLMs such as ChatGPT, Claude, and Gemini

Project description

PyPI version

API Chatbots

A Python library that simplifies interactions with various Large Language Model APIs including ChatGPT, Claude, and Gemini.

Usage

Managing Conversation Context

The library maintains conversation history automatically. Each interaction is stored in the context:

from api_chatbots import ChatGPT

# Initialize the chatbot with your API key
chatbot = ChatGPT(api_key="your_api_key")

# Add a user message to the conversation
chatbot.add_user_message("Hello, how are you?")

# Generate a response
chatbot.respond()

# Get the latest message
print(chatbot.get_latest_message())

Single Prompt Instances

If you only need to prompt a chatbot once, you can use the prompt function instead of instantiating a full chatbot.

from api_chatbots import prompt, ChatGPT, Claude

turtles = prompt(ChatGPT(api_key="your_api_key"), "Generate a paragraph about Turtles")
print(turtles)

tigers = prompt(Claude(api_key="your_api_key"), "Generate a paragraph about Tigers")
print(tigers)

Supported Models

  • ChatGPT
  • Claude

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

api_chatbots-0.1.6.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

api_chatbots-0.1.6-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file api_chatbots-0.1.6.tar.gz.

File metadata

  • Download URL: api_chatbots-0.1.6.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for api_chatbots-0.1.6.tar.gz
Algorithm Hash digest
SHA256 37a436f94d4532f0cb049d4d4d8e2c93d2f578ebdaf08bde0d9d2a46ddec1ac6
MD5 4d0c3c2e739f16cb1555ee98225b9fbd
BLAKE2b-256 96b0def2bc710b6eed5bc4081bac7414462377d7a9e0bc6759d660f16b00940b

See more details on using hashes here.

File details

Details for the file api_chatbots-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: api_chatbots-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for api_chatbots-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 330923271b735cdb605b93fa78c625f7a7d3e3808a6c4082c71a54c8e57cd83f
MD5 7bffafdf3dd38bbd4753f78c5c07c380
BLAKE2b-256 5b642a79657aca9f0cb07a920654b1b04c38cc9ae80c58c69e70820e9ecee39a

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