Skip to main content

A framework for dynamic action generation and reuse with LLMs

Project description

Action Collective

A framework for dynamic action generation and reuse with LLMs.

Installation

pip install action-collective

Quick Start

from action_collective import ActionClient

client = ActionClient(
    openai_api_key=os.getenv("OPENAI_API_KEY"),
    backend_url=os.getenv("BACKEND_URL", "http://70.179.0.242:11000"),
    verbose=True,
)
prompt = """Please perform the matrix multiplication of A x B and return the result, here are the variables:
A = [[1, 2, 3, 4, 5],
        [6, 7, 7, 9, 10],
        [11, 12, 13, 14, 15],
        [16, 17, 7, 19, 20],
        [21, 22, 23, 24, 25]]
B = [[1, 2, 3, 4, 5],
        [6, 7, 8, 9, 10],
        [11, 12, 7, 14, 15],
        [16, 17, 18, 19, 20],
        [21, 22, 23, 24, 25]]"""

chat_history = [{"role": "user", "content": prompt}]

result = await client.execute(chat_history=chat_history)
print("\n\nresult:\n", json.dumps(result, indent=4), "\n\n")
matrix = [
    [215, 230, 227, 260, 275],
    [479, 518, 515, 596, 635],
    [765, 830, 817, 960, 1025],
    [919, 998, 1035, 1156, 1235],
    [1315, 1430, 1407, 1660, 1775],
]
# validate that each of the number inside matrix exist in the result string
assert result is not None
for row in matrix:
    for number in row:
        assert str(number) in result[-1]["content"]
print("\n\nPASSED\n\n")

Features

  • Dynamic action generation
  • Action reuse through vector similarity
  • Automatic validation and testing
  • Easy integration with OpenAI models

Documentation

For full documentation, visit our GitHub repository.

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

action_collective-0.0.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

action_collective-0.0.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file action_collective-0.0.4.tar.gz.

File metadata

  • Download URL: action_collective-0.0.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.9.0 Windows/10

File hashes

Hashes for action_collective-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6263a4e216fddbb11d2787faa7aca362677938c2e9da7c35bedd08be376eb640
MD5 b0dfdbe951aac967305f7cd8f9f132bd
BLAKE2b-256 4ec4174b35114e527d31343e58fb36ea93f1054a21ea36ffa72925f5cca05e2a

See more details on using hashes here.

File details

Details for the file action_collective-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: action_collective-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.9.0 Windows/10

File hashes

Hashes for action_collective-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c608974cb514a451c3ac7940fd5304b49b6675b8dc68f05f22bf58f130884608
MD5 1eea99e11fdb6070f797854531cd4a28
BLAKE2b-256 e09207dfc14adc5596f882d50d5e27b6c07047f97232d4270095865fbbe47bb4

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