diff --git a/genai-function-calling/openai-agents/Dockerfile b/genai-function-calling/openai-agents/Dockerfile index 330bee6..9ce674a 100644 --- a/genai-function-calling/openai-agents/Dockerfile +++ b/genai-function-calling/openai-agents/Dockerfile @@ -1,5 +1,11 @@ # Use glibc-based image with pre-compiled wheels for psutil -FROM python:3.12-slim +FROM python:3.13-slim + +# TODO: temporary until openinference-instrumentation-mcp 1.3.1 with ValidationError fix +RUN apt-get update \ + && apt-get install -y --no-install-recommends git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* RUN --mount=type=cache,target=/root/.cache/pip python -m pip install --upgrade pip diff --git a/genai-function-calling/openai-agents/README.md b/genai-function-calling/openai-agents/README.md index 5d6a6b0..68fdd81 100644 --- a/genai-function-calling/openai-agents/README.md +++ b/genai-function-calling/openai-agents/README.md @@ -81,13 +81,13 @@ run pytest with dotenv, so that ENV variables are present: ```bash rm cassettes/test_main.yaml -dotenv -f ../.env run -- pytest +dotenv -f .env run -- pytest ``` ## Notes The LLM should generate something like "The latest stable version of -Elasticsearch is 8.18.0", unless it hallucinates. Just run it again, if you +Elasticsearch is 8.19.3", unless it hallucinates. Just run it again, if you see something else. OpenAI Agents SDK's OpenTelemetry instrumentation is via diff --git a/genai-function-calling/openai-agents/cassettes/test_main.yaml b/genai-function-calling/openai-agents/cassettes/test_main.yaml index f012390..b8a77ed 100644 --- a/genai-function-calling/openai-agents/cassettes/test_main.yaml +++ b/genai-function-calling/openai-agents/cassettes/test_main.yaml @@ -9,8 +9,9 @@ interactions: } ], "model": "gpt-4o-mini", + "store": true, "stream": false, - "temperature": 0, + "temperature": 0.0, "tools": [ { "type": "function", @@ -41,13 +42,13 @@ interactions: connection: - keep-alive content-length: - - '551' + - '566' content-type: - application/json host: - api.openai.com user-agent: - - Agents/Python 0.0.0 + - Agents/Python 0.2.11 x-stainless-arch: - arm64 x-stainless-async: @@ -57,7 +58,7 @@ interactions: x-stainless-os: - MacOS x-stainless-package-version: - - 1.66.3 + - 1.105.0 x-stainless-read-timeout: - '600' x-stainless-retry-count: @@ -65,16 +66,16 @@ interactions: x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.9 + - 3.13.5 method: POST uri: https://api.openai.com/v1/chat/completions response: body: string: |- { - "id": "chatcmpl-BCezuQjRIx8MotUzQJcjJSYe9TyHv", + "id": "chatcmpl-CCIvaceDOPdzWU2BlnQf3NqndBJ7Y", "object": "chat.completion", - "created": 1742357230, + "created": 1757048730, "model": "gpt-4o-mini-2024-07-18", "choices": [ { @@ -84,7 +85,7 @@ interactions: "content": null, "tool_calls": [ { - "id": "call_pT4CJ0D2kmnTP5WoVhv2edrt", + "id": "call_dRlRcX5ty8twG6mge0ADUBsq", "type": "function", "function": { "name": "get_latest_elasticsearch_version", @@ -101,8 +102,8 @@ interactions: ], "usage": { "prompt_tokens": 104, - "completion_tokens": 19, - "total_tokens": 123, + "completion_tokens": 18, + "total_tokens": 122, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -115,19 +116,21 @@ interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b8bc95a0ac" + "system_fingerprint": "fp_8bda4d3a2c" } headers: CF-RAY: - - 922a19f41e4a071d-ATL + - 97a331226d659b97-SIN Connection: - keep-alive Content-Type: - application/json Date: - - Wed, 19 Mar 2025 04:07:11 GMT + - Fri, 05 Sep 2025 05:05:31 GMT Server: - cloudflare + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload Transfer-Encoding: - chunked X-Content-Type-Options: @@ -141,11 +144,13 @@ interactions: content-length: - '1108' openai-processing-ms: - - '502' + - '567' + openai-project: + - proj_KYenqYOfeZsnXEVK8dXVBhez openai-version: - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload + x-envoy-upstream-service-time: + - '570' x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -153,13 +158,13 @@ interactions: x-ratelimit-remaining-requests: - '9999' x-ratelimit-remaining-tokens: - - '199971' + - '199986' x-ratelimit-reset-requests: - 8.64s x-ratelimit-reset-tokens: - - 8ms + - 4ms x-request-id: - - req_2f55cdcb162fb892f0050536bbd987b5 + - req_4f610e44243841779beb2052dc7ba315 status: code: 200 message: OK @@ -203,6 +208,38 @@ interactions: "version": "6.8.1", "public_release_date": "2019-06-20" }, + { + "version": "6.8.2", + "public_release_date": "2019-07-30" + }, + { + "version": "6.8.3", + "public_release_date": "2019-09-05" + }, + { + "version": "6.8.4", + "public_release_date": "2019-10-23" + }, + { + "version": "6.8.5", + "public_release_date": "2019-11-20" + }, + { + "version": "6.8.6", + "public_release_date": "2019-12-18" + }, + { + "version": "6.8.7", + "public_release_date": "2020-03-03" + }, + { + "version": "6.8.8", + "public_release_date": "2020-03-31" + }, + { + "version": "6.8.9", + "public_release_date": "2020-05-13" + }, { "version": "6.8.10", "public_release_date": "2020-06-03" @@ -243,10 +280,6 @@ interactions: "version": "6.8.19", "public_release_date": "2021-09-21" }, - { - "version": "6.8.2", - "public_release_date": "2019-07-30" - }, { "version": "6.8.20", "public_release_date": "2021-10-14" @@ -263,34 +296,6 @@ interactions: "version": "6.8.23", "public_release_date": "2022-01-13" }, - { - "version": "6.8.3", - "public_release_date": "2019-09-05" - }, - { - "version": "6.8.4", - "public_release_date": "2019-10-23" - }, - { - "version": "6.8.5", - "public_release_date": "2019-11-20" - }, - { - "version": "6.8.6", - "public_release_date": "2019-12-18" - }, - { - "version": "6.8.7", - "public_release_date": "2020-03-03" - }, - { - "version": "6.8.8", - "public_release_date": "2020-03-31" - }, - { - "version": "6.8.9", - "public_release_date": "2020-05-13" - }, { "version": "7.0.0 GA", "public_release_date": "2019-04-10" @@ -327,6 +332,94 @@ interactions: "version": "7.1.1", "public_release_date": "2019-05-28" }, + { + "version": "7.2.0", + "public_release_date": "2019-06-25" + }, + { + "version": "7.2.1", + "public_release_date": "2019-07-30" + }, + { + "version": "7.3.0", + "public_release_date": "2019-07-31" + }, + { + "version": "7.3.1", + "public_release_date": "2019-08-22" + }, + { + "version": "7.3.2", + "public_release_date": "2019-09-12" + }, + { + "version": "7.4.0", + "public_release_date": "2019-10-01" + }, + { + "version": "7.4.1", + "public_release_date": "2019-10-23" + }, + { + "version": "7.4.2", + "public_release_date": "2019-10-31" + }, + { + "version": "7.5.0", + "public_release_date": "2019-12-02" + }, + { + "version": "7.5.1", + "public_release_date": "2019-12-18" + }, + { + "version": "7.5.2", + "public_release_date": "2020-01-21" + }, + { + "version": "7.6.0", + "public_release_date": "2020-02-11" + }, + { + "version": "7.6.1", + "public_release_date": "2020-03-03" + }, + { + "version": "7.6.2", + "public_release_date": "2020-03-31" + }, + { + "version": "7.7.0", + "public_release_date": "2020-05-13" + }, + { + "version": "7.7.1", + "public_release_date": "2020-06-03" + }, + { + "version": "7.8.0", + "public_release_date": "2020-06-18" + }, + { + "version": "7.8.1", + "public_release_date": "2020-07-27" + }, + { + "version": "7.9.0", + "public_release_date": "2020-08-18" + }, + { + "version": "7.9.1", + "public_release_date": "2020-09-03" + }, + { + "version": "7.9.2", + "public_release_date": "2020-09-24" + }, + { + "version": "7.9.3", + "public_release_date": "2020-10-22" + }, { "version": "7.10.0", "public_release_date": "2020-11-11" @@ -427,6 +520,38 @@ interactions: "version": "7.17.1", "public_release_date": "2022-02-28" }, + { + "version": "7.17.2", + "public_release_date": "2022-03-31" + }, + { + "version": "7.17.3", + "public_release_date": "2022-04-20" + }, + { + "version": "7.17.4", + "public_release_date": "2022-05-24" + }, + { + "version": "7.17.5", + "public_release_date": "2022-06-28" + }, + { + "version": "7.17.6", + "public_release_date": "2022-08-24" + }, + { + "version": "7.17.7", + "public_release_date": "2022-10-25" + }, + { + "version": "7.17.8", + "public_release_date": "2022-12-08" + }, + { + "version": "7.17.9", + "public_release_date": "2023-02-02" + }, { "version": "7.17.10", "public_release_date": "2023-05-02" @@ -467,10 +592,6 @@ interactions: "version": "7.17.19", "public_release_date": "2024-03-26" }, - { - "version": "7.17.2", - "public_release_date": "2022-03-31" - }, { "version": "7.17.20", "public_release_date": "2024-04-08" @@ -509,164 +630,165 @@ interactions: "manifest": "https://artifacts.elastic.co/downloads/7.17.28.json" }, { - "version": "7.17.3", - "public_release_date": "2022-04-20" + "version": "7.17.29", + "manifest": "https://artifacts.elastic.co/downloads/7.17.29.json", + "public_release_date": "2025-06-24" }, { - "version": "7.17.4", - "public_release_date": "2022-05-24" + "version": "8.0.0 GA", + "public_release_date": "2022-02-10" }, { - "version": "7.17.5", - "public_release_date": "2022-06-28" + "version": "8.0.0-alpha1", + "public_release_date": "2021-08-10" }, { - "version": "7.17.6", - "public_release_date": "2022-08-24" + "version": "8.0.0-alpha2", + "public_release_date": "2021-09-16" }, { - "version": "7.17.7", - "public_release_date": "2022-10-25" + "version": "8.0.0-beta1", + "public_release_date": "2021-11-09" }, { - "version": "7.17.8", - "public_release_date": "2022-12-08" + "version": "8.0.0-rc1", + "public_release_date": "2022-01-12" }, { - "version": "7.17.9", - "public_release_date": "2023-02-02" + "version": "8.0.0-rc2", + "public_release_date": "2022-02-03" }, { - "version": "7.2.0", - "public_release_date": "2019-06-25" + "version": "8.0.1", + "public_release_date": "2022-03-01" }, { - "version": "7.2.1", - "public_release_date": "2019-07-30" + "version": "8.1.0", + "public_release_date": "2022-03-08" }, { - "version": "7.3.0", - "public_release_date": "2019-07-31" + "version": "8.1.1", + "public_release_date": "2022-03-22" }, { - "version": "7.3.1", - "public_release_date": "2019-08-22" + "version": "8.1.2", + "public_release_date": "2022-03-31" }, { - "version": "7.3.2", - "public_release_date": "2019-09-12" + "version": "8.1.3", + "public_release_date": "2022-04-20" }, { - "version": "7.4.0", - "public_release_date": "2019-10-01" + "version": "8.2.0", + "public_release_date": "2022-05-03" }, { - "version": "7.4.1", - "public_release_date": "2019-10-23" + "version": "8.2.1", + "public_release_date": "2022-05-24" }, { - "version": "7.4.2", - "public_release_date": "2019-10-31" + "version": "8.2.2", + "public_release_date": "2022-05-26" }, { - "version": "7.5.0", - "public_release_date": "2019-12-02" + "version": "8.2.3", + "public_release_date": "2022-06-14" }, { - "version": "7.5.1", - "public_release_date": "2019-12-18" + "version": "8.3.0", + "public_release_date": "2022-06-28" }, { - "version": "7.5.2", - "public_release_date": "2020-01-21" + "version": "8.3.1", + "public_release_date": "2022-06-30" }, { - "version": "7.6.0", - "public_release_date": "2020-02-11" + "version": "8.3.2", + "public_release_date": "2022-07-07" }, { - "version": "7.6.1", - "public_release_date": "2020-03-03" + "version": "8.3.3", + "public_release_date": "2022-07-28" }, { - "version": "7.6.2", - "public_release_date": "2020-03-31" + "version": "8.4.0", + "public_release_date": "2022-08-24" }, { - "version": "7.7.0", - "public_release_date": "2020-05-13" + "version": "8.4.1", + "public_release_date": "2022-08-30" }, { - "version": "7.7.1", - "public_release_date": "2020-06-03" + "version": "8.4.2", + "public_release_date": "2022-09-20" }, { - "version": "7.8.0", - "public_release_date": "2020-06-18" + "version": "8.4.3", + "public_release_date": "2022-10-05" }, { - "version": "7.8.1", - "public_release_date": "2020-07-27" + "version": "8.5.0", + "public_release_date": "2022-11-01" }, { - "version": "7.9.0", - "public_release_date": "2020-08-18" + "version": "8.5.1", + "public_release_date": "2022-11-15" }, { - "version": "7.9.1", - "public_release_date": "2020-09-03" + "version": "8.5.2", + "public_release_date": "2022-11-22" }, { - "version": "7.9.2", - "public_release_date": "2020-09-24" + "version": "8.5.3", + "public_release_date": "2022-12-08" }, { - "version": "7.9.3", - "public_release_date": "2020-10-22" + "version": "8.6.0", + "public_release_date": "2023-01-10" }, { - "version": "8.0.0 GA", - "public_release_date": "2022-02-10" + "version": "8.6.1", + "public_release_date": "2023-01-26" }, { - "version": "8.0.0-alpha1", - "public_release_date": "2021-08-10" + "version": "8.6.2", + "public_release_date": "2023-02-16" }, { - "version": "8.0.0-alpha2", - "public_release_date": "2021-09-16" + "version": "8.7.0", + "public_release_date": "2023-03-30" }, { - "version": "8.0.0-beta1", - "public_release_date": "2021-11-09" + "version": "8.7.1", + "public_release_date": "2023-05-02" }, { - "version": "8.0.0-rc1", - "public_release_date": "2022-01-12" + "version": "8.7.2", + "public_release_date": "2023-05-23" }, { - "version": "8.0.0-rc2", - "public_release_date": "2022-02-03" + "version": "8.8.0", + "public_release_date": "2023-05-25" }, { - "version": "8.0.1", - "public_release_date": "2022-03-01" + "version": "8.8.1", + "public_release_date": "2023-06-08" }, { - "version": "8.1.0", - "public_release_date": "2022-03-08" + "version": "8.8.2", + "public_release_date": "2023-06-29" }, { - "version": "8.1.1", - "public_release_date": "2022-03-22" + "version": "8.9.0", + "public_release_date": "2023-07-25" }, { - "version": "8.1.2", - "public_release_date": "2022-03-31" + "version": "8.9.1", + "public_release_date": "2023-08-17" }, { - "version": "8.1.3", - "public_release_date": "2022-04-20" + "version": "8.9.2", + "public_release_date": "2023-09-06" }, { "version": "8.10.0", @@ -818,6 +940,11 @@ interactions: "public_release_date": "2025-03-04", "manifest": "https://artifacts.elastic.co/downloads/8.16.5.json" }, + { + "version": "8.16.6", + "manifest": "https://artifacts.elastic.co/downloads/8.16.6.json", + "public_release_date": "2025-03-25" + }, { "version": "8.17.0", "public_release_date": "2024-12-12", @@ -834,132 +961,165 @@ interactions: "manifest": "https://artifacts.elastic.co/downloads/8.17.2.json" }, { - "version": "8.18.0", + "version": "8.17.3", "public_release_date": "2025-03-04", - "manifest": "https://artifacts.elastic.co/downloads/8.18.0.json" + "manifest": "https://artifacts.elastic.co/downloads/8.17.3.json" }, { - "version": "8.2.0", - "public_release_date": "2022-05-03" + "version": "8.17.4", + "manifest": "https://artifacts.elastic.co/downloads/8.17.4.json", + "public_release_date": "2025-03-25" }, { - "version": "8.2.1", - "public_release_date": "2022-05-24" + "version": "8.17.5", + "manifest": "https://artifacts.elastic.co/downloads/8.17.5.json", + "public_release_date": "2025-04-15" }, { - "version": "8.2.2", - "public_release_date": "2022-05-26" + "version": "8.17.6", + "manifest": "https://artifacts.elastic.co/downloads/8.17.6.json", + "public_release_date": "2025-05-06" }, { - "version": "8.2.3", - "public_release_date": "2022-06-14" + "version": "8.17.7", + "manifest": "https://artifacts.elastic.co/downloads/8.17.7.json", + "public_release_date": "2025-06-03" }, { - "version": "8.3.0", - "public_release_date": "2022-06-28" + "version": "8.17.8", + "manifest": "https://artifacts.elastic.co/downloads/8.17.8.json", + "public_release_date": "2025-06-24" }, { - "version": "8.3.1", - "public_release_date": "2022-06-30" + "version": "8.17.9", + "manifest": "https://artifacts.elastic.co/downloads/8.17.9.json", + "public_release_date": "2025-07-22" }, { - "version": "8.3.2", - "public_release_date": "2022-07-07" + "version": "8.17.10", + "manifest": "https://artifacts.elastic.co/downloads/8.17.10.json", + "public_release_date": "2025-08-12" }, { - "version": "8.3.3", - "public_release_date": "2022-07-28" + "version": "8.18.0", + "manifest": "https://artifacts.elastic.co/downloads/8.18.0.json", + "public_release_date": "2025-04-15" }, { - "version": "8.4.0", - "public_release_date": "2022-08-24" + "version": "8.18.1", + "manifest": "https://artifacts.elastic.co/downloads/8.18.1.json", + "public_release_date": "2025-05-06" }, { - "version": "8.4.1", - "public_release_date": "2022-08-30" + "version": "8.18.2", + "manifest": "https://artifacts.elastic.co/downloads/8.18.2.json", + "public_release_date": "2025-05-29" }, { - "version": "8.4.2", - "public_release_date": "2022-09-20" + "version": "8.18.3", + "manifest": "https://artifacts.elastic.co/downloads/8.18.3.json", + "public_release_date": "2025-06-24" }, { - "version": "8.4.3", - "public_release_date": "2022-10-05" + "version": "8.18.4", + "manifest": "https://artifacts.elastic.co/downloads/8.18.4.json", + "public_release_date": "2025-07-22" }, { - "version": "8.5.0", - "public_release_date": "2022-11-01" + "version": "8.18.5", + "manifest": "https://artifacts.elastic.co/downloads/8.18.5.json", + "public_release_date": "2025-08-12" }, { - "version": "8.5.1", - "public_release_date": "2022-11-15" + "version": "8.18.6", + "manifest": "https://artifacts.elastic.co/downloads/8.18.6.json", + "public_release_date": "2025-08-28" }, { - "version": "8.5.2", - "public_release_date": "2022-11-22" + "version": "8.19.0", + "manifest": "https://artifacts.elastic.co/downloads/8.19.0.json", + "public_release_date": "2025-07-29" }, { - "version": "8.5.3", - "public_release_date": "2022-12-08" + "version": "8.19.1", + "manifest": "https://artifacts.elastic.co/downloads/8.19.1.json", + "public_release_date": "2025-08-07" }, { - "version": "8.6.0", - "public_release_date": "2023-01-10" + "version": "8.19.2", + "manifest": "https://artifacts.elastic.co/downloads/8.19.2.json", + "public_release_date": "2025-08-12" }, { - "version": "8.6.1", - "public_release_date": "2023-01-26" + "version": "8.19.3", + "manifest": "https://artifacts.elastic.co/downloads/8.19.3.json", + "public_release_date": "2025-08-28" }, { - "version": "8.6.2", - "public_release_date": "2023-02-16" + "version": "9.0.0", + "manifest": "https://artifacts.elastic.co/downloads/9.0.0.json", + "public_release_date": "2025-04-15" }, { - "version": "8.7.0", - "public_release_date": "2023-03-30" + "version": "9.0.0-beta1", + "public_release_date": "2025-02-18", + "manifest": "https://artifacts.elastic.co/downloads/9.0.0-beta1.json" }, { - "version": "8.7.1", - "public_release_date": "2023-05-02" + "version": "9.0.1", + "manifest": "https://artifacts.elastic.co/downloads/9.0.1.json", + "public_release_date": "2025-05-06" }, { - "version": "8.7.2", - "public_release_date": "2023-05-23" + "version": "9.0.2", + "manifest": "https://artifacts.elastic.co/downloads/9.0.2.json", + "public_release_date": "2025-06-03" }, { - "version": "8.8.0", - "public_release_date": "2023-05-25" + "version": "9.0.3", + "manifest": "https://artifacts.elastic.co/downloads/9.0.3.json", + "public_release_date": "2025-06-24" }, { - "version": "8.8.1", - "public_release_date": "2023-06-08" + "version": "9.0.4", + "manifest": "https://artifacts.elastic.co/downloads/9.0.4.json", + "public_release_date": "2025-07-22" }, { - "version": "8.8.2", - "public_release_date": "2023-06-29" + "version": "9.0.5", + "manifest": "https://artifacts.elastic.co/downloads/9.0.5.json", + "public_release_date": "2025-08-12" }, { - "version": "8.9.0", - "public_release_date": "2023-07-25" + "version": "9.0.6", + "manifest": "https://artifacts.elastic.co/downloads/9.0.6.json", + "public_release_date": "2025-08-28" }, { - "version": "8.9.1", - "public_release_date": "2023-08-17" + "version": "9.1.0", + "manifest": "https://artifacts.elastic.co/downloads/9.1.0.json", + "public_release_date": "2025-07-29" }, { - "version": "8.9.2", - "public_release_date": "2023-09-06" + "version": "9.1.1", + "manifest": "https://artifacts.elastic.co/downloads/9.1.1.json", + "public_release_date": "2025-08-07" }, { - "version": "9.0.0-beta1", - "public_release_date": "2025-02-18", - "manifest": "https://artifacts.elastic.co/downloads/9.0.0-beta1.json" + "version": "9.1.2", + "manifest": "https://artifacts.elastic.co/downloads/9.1.2.json", + "public_release_date": "2025-08-12" + }, + { + "version": "9.1.3", + "manifest": "https://artifacts.elastic.co/downloads/9.1.3.json", + "public_release_date": "2025-08-28" } ] } headers: Age: - - '306' + - '991' Alt-Svc: - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 Cache-Control: @@ -967,11 +1127,11 @@ interactions: Content-Type: - application/json Date: - - Wed, 19 Mar 2025 04:02:05 GMT + - Fri, 05 Sep 2025 04:49:00 GMT ETag: - - W/"d008556073cae98499043fe65c244543" + - W/"e3fdaae554ea6ee83b5923fc2b548866" Last-Modified: - - Fri, 07 Mar 2025 09:30:54 GMT + - Thu, 28 Aug 2025 09:31:06 GMT Strict-Transport-Security: - max-age=31536000; includeSubDomains Vary: @@ -979,7 +1139,7 @@ interactions: Via: - 1.1 google content-length: - - '20984' + - '21853' status: code: 200 message: OK @@ -995,7 +1155,7 @@ interactions: "role": "assistant", "tool_calls": [ { - "id": "call_pT4CJ0D2kmnTP5WoVhv2edrt", + "id": "call_dRlRcX5ty8twG6mge0ADUBsq", "type": "function", "function": { "name": "get_latest_elasticsearch_version", @@ -1006,13 +1166,14 @@ interactions: }, { "role": "tool", - "tool_call_id": "call_pT4CJ0D2kmnTP5WoVhv2edrt", - "content": "8.18.0" + "tool_call_id": "call_dRlRcX5ty8twG6mge0ADUBsq", + "content": "8.19.3" } ], "model": "gpt-4o-mini", + "store": true, "stream": false, - "temperature": 0, + "temperature": 0.0, "tools": [ { "type": "function", @@ -1043,13 +1204,13 @@ interactions: connection: - keep-alive content-length: - - '817' + - '832' content-type: - application/json host: - api.openai.com user-agent: - - Agents/Python 0.0.0 + - Agents/Python 0.2.11 x-stainless-arch: - arm64 x-stainless-async: @@ -1059,7 +1220,7 @@ interactions: x-stainless-os: - MacOS x-stainless-package-version: - - 1.66.3 + - 1.105.0 x-stainless-read-timeout: - '600' x-stainless-retry-count: @@ -1067,23 +1228,23 @@ interactions: x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.12.9 + - 3.13.5 method: POST uri: https://api.openai.com/v1/chat/completions response: body: string: |- { - "id": "chatcmpl-BCezvs9dfzeyJNyWqWMTNrHfQlfHh", + "id": "chatcmpl-CCIvcIK3vgSI5fx3iCWRrRs2UGcMZ", "object": "chat.completion", - "created": 1742357231, + "created": 1757048732, "model": "gpt-4o-mini-2024-07-18", "choices": [ { "index": 0, "message": { "role": "assistant", - "content": "The latest version of Elasticsearch 8 is 8.18.0.", + "content": "The latest version of Elasticsearch 8 is 8.19.3.", "refusal": null, "annotations": [] }, @@ -1093,8 +1254,8 @@ interactions: ], "usage": { "prompt_tokens": 138, - "completion_tokens": 17, - "total_tokens": 155, + "completion_tokens": 16, + "total_tokens": 154, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 @@ -1107,19 +1268,21 @@ interactions: } }, "service_tier": "default", - "system_fingerprint": "fp_b8bc95a0ac" + "system_fingerprint": "fp_8bda4d3a2c" } headers: CF-RAY: - - 922a19f98d39071d-ATL + - 97a3312cfd019b97-SIN Connection: - keep-alive Content-Type: - application/json Date: - - Wed, 19 Mar 2025 04:07:12 GMT + - Fri, 05 Sep 2025 05:05:32 GMT Server: - cloudflare + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload Transfer-Encoding: - chunked X-Content-Type-Options: @@ -1133,11 +1296,13 @@ interactions: content-length: - '857' openai-processing-ms: - - '481' + - '476' + openai-project: + - proj_KYenqYOfeZsnXEVK8dXVBhez openai-version: - '2020-10-01' - strict-transport-security: - - max-age=31536000; includeSubDomains; preload + x-envoy-upstream-service-time: + - '480' x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -1145,13 +1310,13 @@ interactions: x-ratelimit-remaining-requests: - '9998' x-ratelimit-remaining-tokens: - - '199967' + - '199983' x-ratelimit-reset-requests: - - 16.52s + - 15.637s x-ratelimit-reset-tokens: - - 9ms + - 5ms x-request-id: - - req_11be6b5836b6a31e8c1d9e64eec1314e + - req_4a8aa725a2374fb0a25ba7c1147f86e2 status: code: 200 message: OK diff --git a/genai-function-calling/openai-agents/env.example b/genai-function-calling/openai-agents/env.example index 7284428..4266f64 100644 --- a/genai-function-calling/openai-agents/env.example +++ b/genai-function-calling/openai-agents/env.example @@ -39,3 +39,7 @@ OTEL_BSP_SCHEDULE_DELAY=3000 # Change to affect behavior of which resources are detected. Note: these # choices are specific to the language, in this case Python. OTEL_EXPERIMENTAL_RESOURCE_DETECTORS=process_runtime,os,otel,telemetry_distro + +# opentelemetry-sdk EventLogger.emit() uses a deprecated LogRecord signature +# until https://github.com/open-telemetry/opentelemetry-python/issues/4687 +PYTHONWARNINGS=ignore diff --git a/genai-function-calling/openai-agents/main.py b/genai-function-calling/openai-agents/main.py index cfad5e3..9175b7e 100644 --- a/genai-function-calling/openai-agents/main.py +++ b/genai-function-calling/openai-agents/main.py @@ -12,16 +12,10 @@ function_tool, Tool, ) -from agents.tracing import GLOBAL_TRACE_PROVIDER from openai import AsyncAzureOpenAI from main_mcp import run_main as mcp_main -# Shut down the global tracer as it sends to the OpenAI "/traces/ingest" -# endpoint, which we aren't using and doesn't exist on alternative backends -# like Ollama. -GLOBAL_TRACE_PROVIDER.shutdown() - async def get_latest_elasticsearch_version(major_version: int = 0) -> str: """Returns the latest GA version of Elasticsearch in "X.Y.Z" format. diff --git a/genai-function-calling/openai-agents/main_test.py b/genai-function-calling/openai-agents/main_test.py index 81743a6..507f9e3 100644 --- a/genai-function-calling/openai-agents/main_test.py +++ b/genai-function-calling/openai-agents/main_test.py @@ -14,4 +14,4 @@ async def test_main(default_openai_env, capsys): reply = capsys.readouterr().out.strip() - assert reply == "The latest version of Elasticsearch 8 is 8.18.0." + assert reply == "The latest version of Elasticsearch 8 is 8.19.3." diff --git a/genai-function-calling/openai-agents/requirements.txt b/genai-function-calling/openai-agents/requirements.txt index ce3961c..cbc666c 100644 --- a/genai-function-calling/openai-agents/requirements.txt +++ b/genai-function-calling/openai-agents/requirements.txt @@ -1,8 +1,12 @@ -openai-agents~=0.0.13 +openai-agents~=0.2.10 httpx~=0.28.1 -mcp~=1.6.0 +mcp~=1.13.1 + +elastic-opentelemetry~=1.7.0 +# TODO: temporary until elastic-opentelemetry release with https://github.com/elastic/elastic-otel-python-instrumentations/pull/90 +elastic-opentelemetry-instrumentation-openai @ git+https://github.com/anuraaga/elastic-otel-python-instrumentations.git@use-logger-workaroun#subdirectory=instrumentation/elastic-opentelemetry-instrumentation-openai -elastic-opentelemetry~=1.0.0 # Use openai-agents and MCP instrumentation from OpenInference -openinference-instrumentation-openai-agents~=0.1.9 -openinference-instrumentation-mcp~=1.2.0 +openinference-instrumentation-openai-agents~=1.2.0 +# TODO: temporary until openinference-instrumentation-mcp 1.3.1 with ValidationError fix +openinference-instrumentation-mcp @ git+https://github.com/codefromthecrypt/openinference.git@mcp-validation-fix#subdirectory=python/instrumentation/openinference-instrumentation-mcp