OpenAI's API for pyfect.ai (Effect's @effect/ai-openai): the
client (the Responses API, embeddings and decisions, and the Responses
API's WebSocket mode), client_generated (a method per operation of the
whole API), their per-call config, the language_model,
embedding_model and decision_model, the provider-defined tool
constructors, the error metadata an AiError carries and the GenAI
telemetry attributes.
Requests go over the HttpClient service with OpenAI's JSON wire
format; streams are read as Server-Sent Events. generated holds the
schemas and client of OpenAI's OpenAPI document, generated by
scripts/gen_ai_schemas.py::
from pyfect.ai.openai import client, language_model
program.pipe(fx.provide(language_model.model("gpt-5").layer)).pipe(
fx.provide(client.layer_config(api_key=config.redacted("OPENAI_API_KEY")))
)Re-exports#
- From
pyfect.ai.openai.client:OpenAiClient,OpenAiSocket - From
pyfect.ai.openai.client_generated:OpenAiClientGenerated - From
pyfect.ai.openai.config:OpenAiConfig