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.5.tar.gz (3.0 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.5-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: api_chatbots-0.1.5.tar.gz
  • Upload date:
  • Size: 3.0 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.5.tar.gz
Algorithm Hash digest
SHA256 a43ee391f92d6b19a2985f5d22c1f76cdf90daf97257848cbd3c7ebd25a0f4d3
MD5 e22518a8e85ebc8a4501ece2ce41175e
BLAKE2b-256 6206c71c54cf7fe5441942c334e8a8efd2c46b23d19566028f7b29ab59a1e06a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: api_chatbots-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 2.5 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6575e2b121d3c3397b1dac3bb06bee0978e00191b34efdcb3dcecae4858f3f1d
MD5 74b4c745cfa98aa5e19af584c8a3df40
BLAKE2b-256 c4d0548922547d1af7e683929c20f7857bf4d2314eabb70c22be949961b624eb

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