Coder Social home page Coder Social logo

robai's Introduction

Your RobAI Agent!

RobAI Framework

Welcome to RobAI - your friendly AI robot framework designed to make working with AI intuitive and easy! RobAI streamlines the construction and utilization of AI robots, offering a simple yet powerful paradigm to interact with AI models. Let's dive into the fun and engaging features that make RobAI the perfect companion for your AI development journey.

Features

1. Before Call - AI Call - After Call Paradigm

RobAI introduces an elegant paradigm for AI interactions:

  • Before Call: Set up your AI prompt and prepare any necessary data.
  • AI Call: The AI processes the prompt and generates a response.
  • After Call: Handle the AI's output and perform any post-processing steps.

2. Stop Condition

Easily define when the interaction with the AI should stop. This flexibility allows you to create AI workflows that can continue until a specific condition is met.

3. AI Description

With the add_description decorator, you can describe your AI functions in a way that makes them easily understandable and accessible. This feature enhances the readability and usability of your AI components.

Getting Started

Here’s a simple example of a summarization robot that can summarize a large amount of text.

Code Example: Summarization Robot

summarization_robot.py

from robai.base import BaseRobot, BaseAI
from robai.schemas import ChatMessage
from typing import Any

class SummarizationRobot(BaseRobot):
    def load(self, input_data: str):
        self.input_data = input_data
        self.system_prompt = f"Please summarize the following text: {input_data}"

    def stop_condition(self) -> bool:
        return True  # Stop after one interaction for simplicity

    async def before_call(self, input_data: Any) -> None:
        user_message = ChatMessage(role="user", content=self.system_prompt)
        self.prompt.append(user_message)

    async def after_call(self, output_data: Any) -> None:
        print(f"Summary: {output_data}")

# Usage example
async def main():
    input_text = "Here is a long text that needs summarization..."
    summarization_robot = SummarizationRobot()
    summarization_robot.load(input_text)
    summary = await summarization_robot.interact()
    print(f"Summary: {summary}")

# Run the example
import asyncio
asyncio.run(main())

Installation

To get started with RobAI, you can install it via pip:

pip install robai

Contributing

We welcome contributions to RobAI! If you have ideas for new features, improvements, or bug fixes, please open an issue or submit a pull request on our GitHub repository.

License

RobAI is open-source software licensed under the MIT License.

Embrace the future of AI development with RobAI. Let's build intelligent robots together! πŸ€–βœ¨

For more information, visit our GitHub repository.

If you have any questions or need further assistance, feel free to reach out. Happy coding! πŸš€

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.