mirror of
https://github.com/hanzoai/agent.git
synced 2026-09-11 21:08:51 +00:00
- Add docker-publish.yml workflow for ghcr.io - Add production-ready Dockerfile (if missing) - Enable automated builds on push to main - Support for semantic versioning tags
27 lines
796 B
Python
27 lines
796 B
Python
from openai import AsyncOpenAI
|
|
from typing_extensions import Literal
|
|
|
|
from .models import _openai_shared
|
|
from .tracing import set_tracing_export_api_key
|
|
|
|
|
|
def set_default_openai_key(key: str, use_for_tracing: bool) -> None:
|
|
_openai_shared.set_default_openai_key(key)
|
|
|
|
if use_for_tracing:
|
|
set_tracing_export_api_key(key)
|
|
|
|
|
|
def set_default_openai_client(client: AsyncOpenAI, use_for_tracing: bool) -> None:
|
|
_openai_shared.set_default_openai_client(client)
|
|
|
|
if use_for_tracing:
|
|
set_tracing_export_api_key(client.api_key)
|
|
|
|
|
|
def set_default_openai_api(api: Literal["chat_completions", "responses"]) -> None:
|
|
if api == "chat_completions":
|
|
_openai_shared.set_use_responses_by_default(False)
|
|
else:
|
|
_openai_shared.set_use_responses_by_default(True)
|