Skip to main content

Function-tool adapter

This separate distribution exports a selected CapabilityCatalog as OpenAI Responses function tools and dispatches returned calls through that catalog. It uses the standard library and the core package; an API SDK is optional in the application that consumes it.

python -m pip install hidden-moves-openai==0.1.0

The experimental 0.1.x adapter depends on hidden-moves>=0.1,<0.2 and Python 3.11 or newer. Published GitHub releases use v0.1.0-openai for this package in the shared repository. .github/workflows/release.yaml checks installed-wheel offline export and dispatch, then publishes in environment pypi-openai.

Local setup

From the repository root, install both distributions in your chosen environment:

uv pip install --python .venv/bin/python -e . -e ./examples/text-plugin -e ./packages/hidden-moves-openai

Export and dispatch work offline:

import asyncio
import json

from hidden_moves import Moves
from hidden_moves.adapters import CapabilityCatalog
from hidden_moves_example_text import repeat_text
from hidden_moves_openai import FunctionToolAdapter

moves = Moves()
moves.learn(repeat_text, name="repeat", namespace="example.text")
adapter = FunctionToolAdapter(CapabilityCatalog(moves, ["example.text.repeat"]))
print(json.dumps(adapter.tools(), indent=2))

output = asyncio.run(adapter.call_output(
	"local-call-1", "example__text__repeat", '{"value": "Hello World"}',
))
assert json.loads(output["output"]) == "Hello World Hello World"

In an existing asynchronous Responses application, pass adapter.tools() as tools. For each returned function_call item, use await adapter.call_output(item.call_id, item.name, item.arguments) to construct its result item. The application keeps the response history, sends results to the API, and decides whether to request another response. The adapter owns no API client, credentials, model choice, retries, approvals, or event loop.

Names and schemas

Dots become double underscores: example.text.repeat exports as example__text__repeat. Names use 1-64 ASCII letters, digits, underscores, or hyphens. Invalid names and collisions fail at construction; use tool_names={"qualified.name": "alias"} for an explicit mapping. The original catalog retains its qualified names.

Tool dictionaries use the flat Responses format, with explicit strict=False by default. This preserves omitted Python defaults. Schema dialect declarations, defaults, and examples are omitted from the exported parameters. Property names and neutral definitions remain unchanged. Behavioral hints and arbitrary metadata stay in the catalog rather than becoming unsupported API fields.

strict=True accepts a conservative structural subset: each object is closed and requires every property; arrays have typed items; unions use anyOf or a nullable type pair. Scalar enums gain an inferred type when possible. Optional properties, open mappings, untyped values, and mixed untyped enums fail exposure. The adapter does not replace omitted arguments with null or invent required defaults. Model-specific schema size limits remain the application's concern.

These choices follow the official function calling guide and Structured Outputs requirements, checked October 3, 2026. Local tests validate export and dispatch. Live API acceptance and a model conversation have not been tested.

Invocation and errors

call(name, arguments) accepts a JSON string or mapping and returns JSON text. call_output adds the supplied call ID in a function_call_output item. Only selected aliases can dispatch, and validation happens before invocation. Async functions and returned awaitables run in the caller's existing loop; synchronous functions run inline. Results use the catalog's dataclass, enum, TypedDict, and finite JSON conversions and output validation.

Invalid arguments raise CapabilityArgumentError; invalid results raise CapabilityResultError; unselected names raise UnknownMoveError. Capability exceptions and cancellation propagate to the application. The application must choose its error reporting and invocation policy before returning failures to a remote service.

Run the adapter tests in an environment with both local packages installed:

python -m unittest discover -s packages/hidden-moves-openai/tests -v

Metadata

Release files for hidden-moves-openai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hidden-moves-openai 0.1.0
File Size Uploaded
hidden_moves_openai-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hidden-moves-openai 0.1.0
File Interpreter ABI Platform
hidden_moves_openai-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / hidden_moves_openai-0.1.0.tar.gz

Download URL hidden_moves_openai-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cf5aeb8c0c5bc1f1975dd69ab8efed9cfa387e5d2b951d93654d042d58675b8c
BLAKE2b-256 checksum
How to use checksums
cf4550cfb2a61724de83f6810e59273a2201f5a6c70701b856957eef344b1db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / hidden_moves_openai-0.1.0-py3-none-any.whl

Download URL hidden_moves_openai-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0406941d43b3ab0224dcc8a13fe963a7ed4f8aebd24290030331715952c66d34
BLAKE2b-256 checksum
How to use checksums
abde21180af0503fd0d8391bab83c1cd6acb10defeeb86dd4e0dbceb4ee3c0e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page