Skip to main content

AgentLego is a versatile tool library for enhancing LLM-based agents.

Project description

Open in OpenXLab docs PyPI license

English | 简体中文

Introduction

AgentLego is an open-source library of versatile tool APIs to extend and enhance large language model (LLM) based agents, with the following highlight features:

  • Rich set of tools for multimodal extensions of LLM agents including visual perception, image generation and editing, speech processing and visual-language reasoning, etc.
  • Flexible tool interface that allows users to easily extend custom tools with arbitrary types of arguments and outputs.
  • Easy integration with LLM-based agent frameworks like LangChain, Transformers Agents, Lagent.
  • Support tool serving and remote accessing, which is especially useful for tools with heavy ML models (e.g. ViT) or special environment requirements (e.g. GPU and CUDA).

https://github-production-user-asset-6210df.s3.amazonaws.com/26739999/289006700-2140015c-b5e0-4102-bc54-9a1b4e3db9ec.mp4

Quick Starts

Installation

Install the AgentLego package

pip install agentlego

Install tool-specific dependencies

Some tools requires extra packages, please check the readme file of the tool, and confirm all requirements are satisfied.

For example, if we want to use the ImageDescription tool. We need to check the Set up section of readme and install the requirements.

pip install -U openmim
mim install -U mmpretrain

Use tools directly

from agentlego import list_tools, load_tool

print(list_tools())  # list tools in AgentLego

image_caption_tool = load_tool('ImageDescription', device='cuda')
print(image_caption_tool.description)
image = './examples/demo.png'
caption = image_caption_tool(image)

Integrated into agent frameworks

Supported Tools

General ability

Speech related

Image-processing related

  • ImageDescription: Describe the input image.
  • OCR: Recognize the text from a photo.
  • VQA: Answer the question according to the image.
  • HumanBodyPose: Estimate the pose or keypoints of human in an image.
  • HumanFaceLandmark: Estimate the landmark or keypoints of human faces in an image.
  • ImageToCanny: Extract the edge image from an image.
  • ImageToDepth: Generate the depth image of an image.
  • ImageToScribble: Generate a sketch scribble of an image.
  • ObjectDetection: Detect all objects in the image.
  • TextToBbox: Detect specific objects described by the given text in the image.
  • Segment Anything series
    • SegmentAnything: Segment all items in the image.
    • SegmentObject: Segment the certain objects in the image according to the given object name.

AIGC related

Licence

This project is released under the Apache 2.0 license. Users should also ensure compliance with the licenses governing the models used in this project.

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

agentlego-0.2.0.tar.gz (78.0 kB view details)

Uploaded Source

Built Distribution

agentlego-0.2.0-py3-none-any.whl (108.1 kB view details)

Uploaded Python 3

File details

Details for the file agentlego-0.2.0.tar.gz.

File metadata

  • Download URL: agentlego-0.2.0.tar.gz
  • Upload date:
  • Size: 78.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for agentlego-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0a64afb56878d78c9533403e33dc16699b0f93c2e08d2116ec169c6c195a2ff3
MD5 7d2af2be16b52b8034d3ebeeb557ef06
BLAKE2b-256 b1fb49fb0cb23ceb5a486f09a56073c3b33273151a91495d8f6982436bf2c204

See more details on using hashes here.

File details

Details for the file agentlego-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agentlego-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 108.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for agentlego-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8350d4e92664fb1d552d71674c84569407921370f638a672ccf2fa27d1f49ef
MD5 6bc2122349be2b31f36a8d7756a8d4f3
BLAKE2b-256 4e8785cd1147f48213ef8970207d46b0ac01b3b5f0ff634d065afce3a5a83dee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page