Metadata-Version: 2.4
Name: acty-openai
Version: 0.1.0
Summary: OpenAI executor for acty
Project-URL: Homepage, https://github.com/conspol/acty-openai
Project-URL: Repository, https://github.com/conspol/acty-openai
Project-URL: Issues, https://github.com/conspol/acty-openai/issues
Maintainer-email: Konstantin Polev <70580603+conspol@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: langchain,openai,telemetry,workflow
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: acty-core<0.2.0,>=0.1.0
Requires-Dist: acty<0.2.0,>=0.1.0
Requires-Dist: langchain-openai>=0.2.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: opentelemetry-sdk>=1.39.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
Requires-Dist: pytest>=9.0.0; extra == 'dev'
Requires-Dist: twine>=5.1.1; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install acty-openai
```

For local development:

```bash
pip install -e .[dev]
```

## Usage

```python
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
