Giter VIP home page Giter VIP logo

prompteus's Introduction

Prompteus

Forge AI agents from simple Python functions. Turn your docstrings into powerful prompts and weave complex AI workflows with ease.

๐ŸŒŸ Features

  • Simple Decorators: Transform ordinary functions into LLM-powered agents with a single decorator.
  • Docstring Prompts: Utilize Python's natural docstring syntax to define your AI prompts.
  • Flexible Agent Creation: Easily create and customize AI agents for various tasks.
  • Graph-based Workflows: Construct complex AI workflows by connecting agents in a graph structure.
  • Seamless Integration: Works smoothly with popular LLM libraries like LangChain.

๐Ÿš€ Installation

Install Prompteus using pip:

pip install prompteus

๐Ÿ”ง Usage

Simple LLM Interaction

from prompteus import llm_interact

@llm_interact(model_name="gpt-3.5-turbo")
def generate_story(theme: str):
    """
    Create a short story based on the given theme.
    The story should be engaging and no longer than 100 words.
    """
    return theme

story = generate_story("A robot learning to paint")
print(story)

Create an AI Agent

from prompteus import agent
from your_custom_tools import ImageAnalysisTool

@agent(model_name="gpt-3.5-turbo", tools=[ImageAnalysisTool()])
def image_analyst():
    """
    Analyze the given image and provide a detailed description.
    Use the ImageAnalysisTool when needed to get more information about specific elements in the image.
    """
    return {}  # Additional context if needed

image_agent, _ = image_analyst()
result = await image_agent({"input": "path/to/image.jpg"})
print(result['messages'][-1].content)

Constructing an Agent Workflow

from prompteus import agent_graph

@agent_graph()
async def analyze_and_critique(image_path: str):
    graph_structure = {
        'nodes': {
            'image_analyst': {'agent': image_analyst()},
            'art_critic': {'agent': art_critic()},
        },
        'edges': [
            {'from': 'image_analyst', 'to': 'art_critic'},
        ],
        'entry_point': 'image_analyst'
    }
    return graph_structure, image_path

result = await analyze_and_critique("path/to/artwork.jpg")
print(result)

prompteus's People

Contributors

enlighten5 avatar

Watchers

 avatar Kostas Georgiou avatar

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.