Skip to main content

OpenAI executor for acty

Project description

acty-openai

acty-openai provides an OpenAIExecutor implementation for Acty. It adapts langchain-openai chat models to the Acty executor interface and emits the shared telemetry attributes used across the wider Acty stack.

Install

pip install acty-openai

For local development:

pip install -e .[dev]

Usage

import asyncio

from acty import ActyEngine, EngineConfig
from acty_openai import OpenAIExecutor
from langchain_openai import ChatOpenAI


async def main() -> None:
    model = ChatOpenAI(model="gpt-4o-mini")
    engine = ActyEngine(
        executor=OpenAIExecutor(model=model),
        config=EngineConfig(primer_workers=1, follower_workers=1),
    )
    try:
        payload = {
            "messages": [{"role": "user", "content": "hello"}],
        }
        submission = await engine.submit_group("demo", payload, [])
        if submission.primer is not None:
            result = await submission.primer
            print(result.output)
    finally:
        await engine.close()


asyncio.run(main())

Notes

  • if you do not pass a model explicitly, OpenAIExecutor requires langchain-openai
  • the executor can attach OpenTelemetry span attributes when telemetry is enabled
  • this package depends directly on both acty and acty-core because it imports both at runtime

Development

  • tests live under tests/
  • the repo includes unit tests plus an Acty engine integration test for shared telemetry behavior

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

acty_openai-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

acty_openai-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file acty_openai-0.1.0.tar.gz.

File metadata

  • Download URL: acty_openai-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for acty_openai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0afe01feb178f252120068197c4f1c599147344e7399cb992c87c9543bf09999
MD5 d69e4c64d33d82319ee69e943e4c2df6
BLAKE2b-256 9380951cc9b2c425572451d025e8d1c2ab8c560b0d7842abbaa153a0b02d3995

See more details on using hashes here.

File details

Details for the file acty_openai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: acty_openai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for acty_openai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdce94282ee12c3be2cc1d3a7ae9f284fdaab63bfbd93f7a4a71ad1fad7fa3c2
MD5 5f6512c688132a15840fe191fcabae04
BLAKE2b-256 905f7830b00c9204f7661a24fcc2f8891f2ff3bc848933ba5e245fe8c281a4ca

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