Skip to main content

A streamlined interface for LangChain based AI agent creation with multi-modal support

Project description

AGI Agents

A streamlined interface for LangChain AI agent creation with multi-modal support (text and images).

Features

  • Simple API: Easy-to-use interface for creating AI agents
  • Multi-modal Support: Handle both text and image inputs seamlessly
  • LangChain Integration: Built on top of the powerful LangChain framework
  • Flexible Models: Support for OpenAI, Anthropic, and other LLM providers
  • Document Processing: PDF and image processing capabilities
  • Context Management: Advanced context engineering utilities
  • Async Support: Both synchronous and asynchronous execution

Installation

pip install agi-agents

Quick Start

from agi_agents import Agents
from langchain_openai import ChatOpenAI

# Initialize your model
llm = ChatOpenAI(model_name='gpt-4o-mini')

# Create a simple text processing chain
chain = Agents.chain_create(
    model=llm,
    text_prompt_template="Answer this question: {question}",
)

# Use the chain
response = Agents.chain_batch_generator(
    chain, 
    {"question": "What is artificial intelligence?"}
)
print(response)

Multi-modal Example

# Create a chain that processes both text and images
chain = Agents.chain_create(
    model=llm,
    text_prompt_template="Describe this image: {description}",
    image_prompt_template=True
)

# Process an image
base64_image = Agents.normalize_image_to_base64("path/to/image.jpg")
response = Agents.chain_batch_generator(
    chain,
    {
        "description": "What do you see?",
        "base64_image": base64_image,
        "detail_parameter": "high"
    }
)

Main Classes

Agents

The core class for creating and managing AI agents:

  • chain_create(): Create LangChain processing chains
  • chain_batch_generator(): Execute chains synchronously
  • chain_stream_generator(): Stream responses in real-time
  • continue_chain_batch_generator(): Handle long conversations with continuation

Contexts

Utility class for context engineering:

  • create_context_layer(): Create context templates
  • compress_context(): Compress contexts to fit token limits

Document

Document processing utilities:

  • extract_text_from_pdf(): Extract text from PDFs
  • convert_pdf_to_images(): Convert PDFs to images
  • pdf_to_base64_images(): Convert PDFs to base64 for LLM processing

Requirements

  • Python 3.8+
  • langchain-openai
  • langchain-anthropic
  • langchain-core
  • PyMuPDF
  • Pillow
  • pillow-heif

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

agi_agents-1.0.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agi_agents-1.0.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file agi_agents-1.0.1.tar.gz.

File metadata

  • Download URL: agi_agents-1.0.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agi_agents-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b4649256e50fe32f85cb74247ae7e4124c4a6b92d057a8fc756fb8d5102f6b1f
MD5 3eae88e8b87b494b4bd79ce8ab6ce024
BLAKE2b-256 94a7031ddfbed49ca841e9d001164600cf75d93eda1fb6fae47e882f54fde51a

See more details on using hashes here.

File details

Details for the file agi_agents-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: agi_agents-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for agi_agents-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74db54eebe4d245003f9a689d779f6b1f47374a925719b23a9176d6c66b0e768
MD5 82fb2d84b456d8aee671d0a7eb407e55
BLAKE2b-256 b03c466651e9ac2f52f87e3d41775e7b02a2382c87a1f156ce5af6340d442cbd

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