Skip to main content

AI agent and tool calling library for small local models using llama.cpp.

Project description

voyage-agents

AI Agents for local GPUs, by Voyage Robotics.

Originally built for a hackathon in 24 hours.

Find a 7B param multi-modal LLaVa x Mistral model in HuggingFace. You can also build models yourself using the llama.cpp library.

This is a standalone package. You need to install the llama_cpp python bindings as well to use voyage_agents.

Installation

See the llama-cpp-python install instructions in the README as the process varies based on your machine configuration, e.g. whether to use CUDA or not.

pip install llama-cpp-python
pip install voyage_agents

Example usage

Imports and model creation.

from llama_cpp import Llama
from llama_cpp.llama_chat_format import Llava16ChatHandler

from voyage_agents.core import LlamaManager

system_prompt = "You are an intelligent robotic assistant that is navigating autonomously in an environment, attempting to complete a given task, and assisting a user with queries."
model_path = "data/llava-v1.6-mistral-7b/llava-v1.6-mistral-7b-8B-F32.gguf"
clip_model_path="data/llava-v1.6-mistral-7b/mmproj.bin"

chat_handler = Llava16ChatHandler(clip_model_path=clip_model_path)
llama = Llama(
    model_path=model_path,
    chat_handler=chat_handler,
    n_gpu_layers=20, # Uncomment to use GPU acceleration
    n_ctx=4092, # Uncomment to increase the context window
    seed=1337, # Uncomment to set a specific seed
)
manager = LlamaManager(llama, temperature=0)

Calling a tool based on a prompt, and returning the result in structured form.

from voyage_agents.agents import ToolCaller
from voyage_agents.tool import SearchObjectsTool, PickObjectTool, ChangeTaskTool

tool_caller = ToolCaller(manager, [SearchObjectsTool(), PickObjectTool(), ChangeTaskTool()], system_prompt)

# easy task
print(tool_caller.call("have you found the object you are looking for yet?"))

Answering a question with the use of tools.

from voyage_agents.agents import QuestionAnswerer
from voyage_agents.tool import SearchObjectsTool, PickObjectTool, ChangeTaskTool

agent = QuestionAnswerer(manager, [SearchObjectsTool(), PickObjectTool(), ChangeTaskTool()], system_prompt)

# easy task
answer = agent.run("how many tables has the robot seen so far?")
print(answer)

See the tools package for examples on how you'd implement your own tools.

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

voyage_agents-0.0.6.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

voyage_agents-0.0.6-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file voyage_agents-0.0.6.tar.gz.

File metadata

  • Download URL: voyage_agents-0.0.6.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for voyage_agents-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4c3dacc2f5830fe279b443946c42f88c1a9e6fb06030007d7c2330381a48c60c
MD5 af0eed2dd72e4a7948d844fa520133df
BLAKE2b-256 6ff90942ba1e0b4b904dcd842afe03c58df19d57254d2c0c19610df1d02ef452

See more details on using hashes here.

File details

Details for the file voyage_agents-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: voyage_agents-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for voyage_agents-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab475137195568243df377323d6dad825a55f0f2383ef3b19b97e2470258a84
MD5 68f79ade395cbda2e21f841f4bc108a4
BLAKE2b-256 ad9978b73fff57ff46db8228186b8f42a420e768a60b54083d4b696ae2c95c50

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