Skip to content

A python package for setting up agentic behavior for LLMs. Includes optimization for large training data, and adherence to applied interactional policies.

License

Notifications You must be signed in to change notification settings

The-Octran-Group/agenpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgenPy 0.1.2 📦

Python ChatGPT

A python package for setting up agentic behavior for LLMs. Includes optimization for large training data, and adherence to applied interactional policies.

Table Of Contents

Features

AgenPy is particularly useful for creating multi-modal agents using LLMs and other AI tools.

  • Set Behavior & Actions:
    Using various APIs, an agent with particular persona can be created. Users can set their behaviors and reactions to different scenarios. User can also set up different tasks to perform according to needs.

  • Database Management:
    Import your knowledge base for extended information to the agent. Is organized into vector databases for ease of recall, hence faster and optimized response rates.

Usage

Import this package into Python using this command. Here is the PyPI website for more details.

pip install agenpy

Create a file named demo.py and paste the following code into it.

import openai
from agenpy.openai import GPTAgent

def main():
    # Initialize the GPTAgent with your API key
    agent = GPTAgent(api_key="your-openai-api-key")

    # Generate a response synchronously
    response = agent.generate()

    # Print the response
    print("Generated Response:", response)

if __name__ == "__main__":
    main()

To execute this code, run the command:

python demo.py

OpenAI Starting Documentation

This is the basic documentation for using the openai module in AgenPy. Here is a more detailed API documentation.

GPT Response from Agent (OpenAI)

Here is a starter code to understand how to use the AgenPy library properly. Create a file named demo.py and paste the following code into it.

import openai
from agenpy.openai import GPTAgent

def main():
    # Initialize the GPTAgent with your API key
    agent = GPTAgent(api_key="your-openai-api-key")

    # Generate a response synchronously
    response = agent.generate()

    # Print the response
    print("Generated Response:", response)

if __name__ == "__main__":
    main()

Note that this program is the same as the code given earlier in the Usages section.

Async GPT Response from Agent (OpenAI)

The output can also be asynchronous using the code below.

import asyncio
import openai
from agenpy.openai import GPTAgent

async def main():
    # Initialize the GPTAgent with async mode enabled and your API key
    agent = GPTAgent(api_key="your-openai-api-key", is_async=True)

    # Generate a response asynchronously
    response = await agent.generate_async()

    # Print the response
    print("Generated Response:", response)

if __name__ == "__main__":
    asyncio.run(main())

GPT Streaming from Agent (OpenAI)

The output can also be streamed using the code below.

import openai
from agenpy.openai import GPTAgent

def main():
    # Initialize the GPTAgent with your API key
    agent = GPTAgent(api_key="your-openai-api-key")

    # Stream the response synchronously
    for chunk in agent.stream():
        # Print each chunk of the streamed response
        print(chunk)

if __name__ == "__main__":
    main()

Async GPT Streaming from Agent (OpenAI)

The output can also be asynchronously streamed using the code below.

import asyncio
import openai
from agenpy.openai import GPTAgent

async def main():
    # Initialize the GPTAgent with async mode enabled and your API key
    agent = GPTAgent(api_key="your-openai-api-key", is_async=True)

    # Stream the response asynchronously
    async for chunk in agent.stream_async():
        # Print each chunk of the streamed response
        print(chunk)

if __name__ == "__main__":
    asyncio.run(main())

Default Values

Here are the default values used by the package. These can and should be changed.

Name: Mr. Octranymous
Role: You are a general robot, tasked with helping the user by answering their questions. Try to make your responses sound engaging and conversational, while maintaining the pace and length of the interaction by analyzing the user. Always try to be friendly, even if the user tries to get you to act harshly.
Is Async: False
Default Model: GPT-4-Omni (gpt-4o)

Donate & Help

If you want to help in the maintenance of this package and keep it open and free for everyone, consider making a donation. It's optional, but we'll be grateful if you did. All of the donations go straight into the development of this package only.

Crypto Network Wallet
Bitcoin bc1qppcjpkcpsrxc35z9zcqcdvtzk333qslc9ft32j
Ethereum 0xc1a9A83fE19a37e362652D9Ca6b7cA12fF3E875d

About

A python package for setting up agentic behavior for LLMs. Includes optimization for large training data, and adherence to applied interactional policies.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages