Skip to main content

A Python SDK to transform Claude response to OpenAI response format

Project description

Agent Response Transformer

A Python SDK to transform Claude response to OpenAI response format.

Installation

Install the package via pip:

pip install agent-response-transformer

Usage

from agent_response_transformer import ResponseTransformer

# Create an instance of the transformer
transformer = ResponseTransformer()

# Transform Claude response to OpenAI format (for full conversation)
result = transformer.claude_json_to_openai_response(claude_response)

# Transform a single Claude response to OpenAI format (for individual messages)
single_result = transformer.single_claude_json_to_openai_response(single_claude_response)

Features

  • Transform Claude response format to OpenAI response format
  • Support for text content and function calls
  • Proper handling of tool usage and results

Development

To install the package in development mode:

pip install -e .

Dependencies

The package has no direct dependencies. However, when using this package in your projects, you may need to install:

  • openai
  • agents (if it's a separate package)

For development, you can install all dependencies using:

pip install -r requirements.txt

Publishing to PyPI

To publish a new version to PyPI:

  1. Update the version in setup.py
  2. Build the package:
    python setup.py sdist bdist_wheel
    
  3. Upload to Test PyPI first:
    twine upload --repository testpypi dist/*
    
  4. Upload to PyPI:
    twine upload dist/*
    

TODO

[] mapping claude code internal mcp to openai agent tools []

License

MIT

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

agent_response_transformer-0.1.2.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

agent_response_transformer-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file agent_response_transformer-0.1.2.tar.gz.

File metadata

File hashes

Hashes for agent_response_transformer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b014f9d1218313eb784486dd275c671058da1f04cc657f88dbca78fd8ecd559e
MD5 a57932d07aa1ec5a55c3880f5ed1001a
BLAKE2b-256 f0209f313ea4a8076c6f728287d82d9446e3660ce0f92c32e1fedfc0f76dfba7

See more details on using hashes here.

File details

Details for the file agent_response_transformer-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_response_transformer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 63b56fe6eb2093cf8e76da664e62b23fe4453a6291f3cd2fb801479c71b88a54
MD5 bfc7a7822c202689afd6b061634a57bc
BLAKE2b-256 c99adb02c13dcbcbe58ad077b8a0af49e601c0720f6d3996d81f9b5d31ade2d1

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