ChatWeaver

pip install chatweaver

What is ChatWeaver?

Introduction

ChatWeaver is a Python library designed to make it easy to create intelligent and highly customizable chatbots. Developed to meet the needs of developers, researchers, and businesses, ChatWeaver combines ease of use with advanced features, offering a versatile tool for any project based on language patterns.

With ChatWeaver, you can:
  • Accelerate chatbot development with an intuitive interface and modular structure.
  • Manage conversations with ease, keeping history for more contextual responses.
  • Integrate multimedia content such as images and PDFs directly into conversations.
  • Adapt and customize AI models to meet your specific needs

Info

Whether you're working on an innovative startup, academic research, or business application, ChatWeaver allows you to turn your vision into reality with a few simple steps. Explore the future of ChatWeaver conversations!


Main Features

Scalability Icon
Scalability
Scale effortlessly from small projects to enterprise-level solutions.
Customization Icon
Customization
Tailor your chatbot's behavior by customizing models, prompts, and response styles.
History Icon
History
Keep track of conversations seamlessly, ensuring context and continuity across interactions.
Abstraction Layer Icon
Abstraction Layer
Simplify chatbot development with an intuitive abstraction layer.

Start Building Now!

Ready to create your own chatbot? With a few simple steps you can start leveraging the power of ChatWeaver.
Here is a sample code to set up your first chatbot:

Model
Initializes and configures the OpenAI language model by specifying the API key and the model type (e.g. gpt-4o).

Bot
Defines the behavior of the chatbot, establishing conversational rules and assigning an identifying name.

Chat
Manages a conversation session between the user and the bot, maintaining the history of messages and controlling the number of interactions.
Bot responses are obtained via the get_response("Your message here") method.

CWArchive
Allows you to save and retrieve chat sessions, bots, or models, making it easy to store and load conversations.

See the documentation for more details.
Code
from chatweaver import Model, Bot, Chat, CWArchive

model = Model(api_key="sk-1234567890abcdef1234...", model="gpt-4o")

bot = Bot(
    cw_model=model,
    rules="You are a friendly and knowledgeable assistant.",
    name="HelpfulBot"
)

chat = Chat(
    cw_bot=bot,
    title="Demo Session",
    replies_limit=3,
    user="Tester"
)

response1 = chat.get_response("Hello, how are you?")
print(chat.bot_name, response1, sep=": ")

response2 = chat.get_response("Can you tell me a joke?")
print(chat.bot_name, response2, sep=": ")

print("Current replies used:", chat.chat_replies)
print("Total tokens so far:", chat.chat_cost)

archive = CWArchive(path="test_archive.txt")
archive + chat
archive.save()
Terminal

HelpfulBot: Hello! I'm just a program, so I don't have feelings, but I'm here and ready to help you. How can I assist you today?
HelpfulBot: Sure thing! Why don't scientists trust atoms? Because they make up everything!

Current replies used: 2
Total tokens so far: 160