-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature] Release for Auto Instrumentation of Google ADK #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis update introduces new Python and TypeScript instrumentation packages, configuration files, and documentation. The Python changes add a Google ADK auto-instrumentation module with OpenTelemetry tracing, usage examples, and packaging metadata. The TypeScript changes add or update core, semantic conventions, OpenAI, Anthropic, and LangChain packages, including new base and per-package TypeScript config files, changelogs, and enhanced dependency management. Several example scripts and detailed README files are included. Changes
Sequence Diagram(s)sequenceDiagram
participant UserScript as User Script
participant GoogleADKInstrumentor as GoogleADKInstrumentor
participant GoogleADK as Google ADK (Agent/Runner)
participant OpenTelemetry as OpenTelemetry Tracer
UserScript->>GoogleADKInstrumentor: Instrument Google ADK
GoogleADKInstrumentor->>GoogleADK: Patch run_async and tracing functions
UserScript->>GoogleADK: Create Agent and Runner
UserScript->>GoogleADK: Run Agent (async)
GoogleADK->>OpenTelemetry: Start tracing span (via wrapper)
GoogleADK-->>UserScript: Yield events/responses
GoogleADK->>OpenTelemetry: End span, record attributes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 10
♻️ Duplicate comments (4)
typescript/packages/traceai_anthropic/tsconfig.esnext.json (1)
1-10: Duplicate ESNext configuration
This file mirrors thetraceai_openai/tsconfig.esnext.jsonsetup. All settings are consistent with the project-wide standard.typescript/packages/traceai_anthropic/tsconfig.esm.json (1)
1-10: Duplicate ESM configuration
This file matchestraceai_openai/tsconfig.esm.jsonexactly, following the same extension of the base ESM config and output conventions.typescript/packages/traceai_langchain/tsconfig.esm.json (1)
1-10: Duplicate: ESM config recommendations
The same suggestions for enabling declarations and cleaning up empty references apply here as infi-semantic-conventions/tsconfig.esm.json.typescript/packages/traceai_langchain/tsconfig.esnext.json (1)
1-10: Duplicate: ESNext config recommendations
Refer to the review onfi-semantic-conventions/tsconfig.esnext.jsonfor enablingdeclaration,declarationMap, andincremental, and removing the emptyreferences.
🧹 Nitpick comments (23)
typescript/packages/fi-semantic-conventions/README.md (1)
1-17: README provides basic usage but could be enriched.Consider adding a brief package overview, a license badge, and example attribute definitions common to this package. Also remove extra blank lines at the end to tighten formatting.
typescript/tsconfig.base.es5.json (1)
1-7: Enhance ES5 base config
Consider adding standard compiler options for ES5 targets, such as"lib": ["es5", "dom"],"module": "commonjs", and"strict": true, to ensure broader compatibility and stricter type checks.typescript/packages/traceai_anthropic/CHANGELOG.md (2)
1-4: Clarify dependency updates in v0.1.1
Currently the change log entry simply states "Dependencies Updated". Consider specifying which dependencies were updated (e.g.,@traceai/fi-core,@traceai/fi-semantic-conventions) or linking relevant issue/PR numbers.
6-9: Improve initial release notes
The v0.1.0 entry could include more context, such as key features ("Anthropic LLM support") or a link to the PR/issue that introduced this support.typescript/packages/traceai_openai/package.json (1)
3-3: Bump package version to 0.1.12
Ensure that the project’sCHANGELOG.mdor release notes have been updated to reflect any new features, fixes, or breaking changes introduced in this release.typescript/packages/fi-core/CHANGELOG.md (2)
2-5: Inconsistent section heading under 0.1.10
Under the “### Feature” header, you have a bullet- Bug Fixesinstead of starting a new “### Bug Fixes” section.
7-23: Provide concrete details for previous releases
Entries like- Bug Fixesor- Dependencies Updatedlack specifics on what was fixed or updated. Consider adding brief bullet points for each changelog entry to improve traceability.typescript/packages/fi-semantic-conventions/tsconfig.esm.json (1)
1-10: Ensure type declarations in ESM build
To emit typings and enable faster incremental builds, consider addingdeclaration,declarationMap, andincrementalflags. Also, you can omit the empty"references": []when not using project references.Apply this diff:
{ "extends": "../../tsconfig.base.esm.json", "compilerOptions": { "outDir": "dist/esm", "rootDir": "src", + "declaration": true, + "declarationMap": true, + "incremental": true, "tsBuildInfoFile": "dist/esm/tsconfig.esm.tsbuildinfo" }, "include": ["src/**/*.ts"] - ,"references": [] + // removed empty references }Please verify that
tsconfig.base.esm.jsondoesn’t already enable these settings.typescript/packages/fi-semantic-conventions/tsconfig.esnext.json (1)
1-10: Ensure type declarations in ESNext build
Similar to the ESM config, adddeclaration,declarationMap, andincrementalundercompilerOptionsand remove the emptyreferencesentry for cleaner configs:{ "extends": "../../tsconfig.base.esnext.json", "compilerOptions": { "outDir": "dist/esnext", "rootDir": "src", + "declaration": true, + "declarationMap": true, + "incremental": true, "tsBuildInfoFile": "dist/esnext/tsconfig.esnext.tsbuildinfo" }, "include": ["src/**/*.ts"] - ,"references": [] + // removed empty references }Confirm whether
tsconfig.base.esnext.jsonalready covers these flags.typescript/packages/fi-semantic-conventions/CHANGELOG.md (1)
1-27: Changelog Traceability: Add Links and Details.The chronological entries cover versions 0.1.0–0.1.8, but they lack PR/issue references or brief descriptions of what changed.
Consider linking to PRs or commits and adding concise feature/fix descriptions for transparency.typescript/packages/fi-core/tsconfig.esm.json (1)
9-9: Consider removing empty references
An empty"references": []is redundant when not using project references; you can drop it to keep the config lean.typescript/packages/traceai_anthropic/tsconfig.json (2)
7-7: Remove redundantfilesarray
An empty"files": []isn’t needed when you’re already using"include"; consider deleting it for clarity.
9-9: Drop emptyreferences
Since there are no project references, the"references": []block can be removed to simplify the config.typescript/packages/traceai_openai/tsconfig.json (2)
7-7: Remove unusedfilesproperty
The empty"files": []adds noise—drop it since"include"handles your file globs.
9-9: Omit emptyreferences
No project references are used, so the"references": []section can be safely removed.python/frameworks/google-adk/pyproject.toml (1)
12-17: Add dev-dependencies for testing and linting
There are no dev dependencies (pytest, mypy, black, etc.). Consider adding them under[tool.poetry.dev-dependencies]for a reproducible development environment.typescript/packages/traceai_langchain/tsconfig.json (2)
7-7: Remove redundantfilesentry
The empty"files": []can be removed when"include"covers your glob patterns.
9-9: Omit unusedreferences
Empty"references": []isn’t necessary without project references; consider removing it.python/frameworks/google-adk/README.md (1)
10-10: Fix minor typographical issues in the documentation.Please address these grammatical improvements:
-In this example we will instrument a small program that uses Gemini and observe the traces in Future AGI Dashboard +In this example, we will instrument a small program that uses Gemini and observe the traces in Future AGI Dashboard-Run the python file to send the traces to Future AGI Platform. +Run the python file to send the traces to the Future AGI Platform.Also applies to: 105-105
🧰 Tools
🪛 LanguageTool
[typographical] ~10-~10: It appears that a comma is missing.
Context: ...or Google ADK. ## Quickstart In this example we will instrument a small program that...(DURING_THAT_TIME_COMMA)
python/frameworks/google-adk/examples/testing_google_adk.py (1)
32-44: Simplify the control flow by removing unnecessary else.The else block is unnecessary after a return statement:
def get_weather(city: str) -> dict: """Retrieves the current weather report for a specified city. Args: city (str): The name of the city for which to retrieve the weather report. Returns: dict: status and result or error msg. """ if city.lower() == "new york": return { "status": "success", "report": ( "The weather in New York is sunny with a temperature of 25 degrees" " Celsius (77 degrees Fahrenheit)." ), } - else: - return { - "status": "error", - "error_message": f"Weather information for '{city}' is not available.", - } + return { + "status": "error", + "error_message": f"Weather information for '{city}' is not available.", + }🧰 Tools
🪛 Pylint (3.3.7)
[refactor] 32-44: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
(R1705)
typescript/packages/traceai_openai/examples/manual.ts (1)
310-319: Consider awaiting shutdown directly instead of using setTimeout.The fixed 2-second delay might not be sufficient for all spans to be exported, especially with network delays.
Replace the setTimeout approach with direct await:
} finally { - // Give time for spans to be exported - setTimeout(async () => { - try { - await tracerProvider.shutdown(); - console.log("Tracer provider shut down successfully."); - } catch (error) { - console.error("Error shutting down tracer provider:", error); - } - }, 2000); + // Ensure all spans are exported before shutting down + try { + await tracerProvider.shutdown(); + console.log("Tracer provider shut down successfully."); + } catch (error) { + console.error("Error shutting down tracer provider:", error); + } }python/frameworks/google-adk/traceai_google_adk/_wrappers.py (2)
328-341: Simplify nested if statements.The nested if statements can be combined for better readability.
if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None): - if responses := event.get_function_responses(): + if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None): + if responses := event.get_function_responses(): try: span.set_attribute( SpanAttributes.OUTPUT_VALUE, responses[0].model_dump_json(exclude_none=True), ) span.set_attribute( SpanAttributes.OUTPUT_MIME_TYPE, FiMimeTypeValues.JSON.value, ) except Exception: logger.exception(f"Failed to get attribute in {wrapped.__name__}.")Actually, combine the conditions:
- if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None): - if responses := event.get_function_responses(): + if (event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None)) and (responses := event.get_function_responses()):🧰 Tools
🪛 Ruff (0.11.9)
328-329: Use a single
ifstatement instead of nestedifstatements(SIM102)
512-522: Remove unnecessary else after return.The else block is unnecessary when the if block contains a return statement.
def _default(obj: Any) -> str: from pydantic import BaseModel if isinstance(obj, BaseModel): return json.dumps( obj.model_dump(exclude=None), ensure_ascii=False, default=str, ) - else: - return str(obj) + return str(obj)🧰 Tools
🪛 Pylint (3.3.7)
[refactor] 515-522: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
(R1705)
🛑 Comments failed to post (10)
python/frameworks/google-adk/.venv/pyvenv.cfg (1)
1-5:
⚠️ Potential issueRemove committed virtual environment
Committing the.venvdirectory is not recommended. It can bloat the repository and introduce environment-specific paths. Please add.venv/to.gitignoreand remove this file from version control.🤖 Prompt for AI Agents
In python/frameworks/google-adk/.venv/pyvenv.cfg lines 1 to 5, the virtual environment configuration file is committed, which is not recommended. Remove the entire .venv directory from version control by deleting it from the repository and add ".venv/" to the .gitignore file to prevent future commits of the virtual environment.typescript/packages/traceai_openai/CHANGELOG.md (1)
1-32:
⚠️ Potential issueChangelog Out of Sync with Package Version.
The changelog tops out at 0.1.10, but
package.jsonwas bumped to 0.1.12 in this PR. Entries for 0.1.11 and 0.1.12 are missing.
Please update the changelog to include those versions with appropriate notes, and consider adding PR/commit links.🤖 Prompt for AI Agents
In typescript/packages/traceai_openai/CHANGELOG.md lines 1 to 32, the changelog is missing entries for versions 0.1.11 and 0.1.12, which are present in package.json. Add changelog sections for these versions with relevant feature or fix notes, and optionally include PR or commit links for better traceability.python/frameworks/google-adk/pyproject.toml (1)
4-4:
⚠️ Potential issueFix package description
Thedescriptionreads "OpenTelemetry instrumentation for Anthropic" but this package targets Google ADK. Please update it to reflect Google ADK instrumentation.🤖 Prompt for AI Agents
In python/frameworks/google-adk/pyproject.toml at line 4, the package description incorrectly states it is for Anthropic. Update the description string to accurately reflect that this package provides OpenTelemetry instrumentation for Google ADK instead.python/frameworks/google-adk/examples/testing_google_adk.py (1)
8-10:
⚠️ Potential issueRemove unused imports.
These imports are not used in the example and should be removed:
-from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter -from opentelemetry.sdk import trace as trace_sdk -from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.🧰 Tools
🪛 Ruff (0.11.9)
8-8:
opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporterimported but unusedRemove unused import:
opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter(F401)
9-9:
opentelemetry.sdk.traceimported but unusedRemove unused import:
opentelemetry.sdk.trace(F401)
10-10:
opentelemetry.sdk.trace.export.ConsoleSpanExporterimported but unusedRemove unused import
(F401)
10-10:
opentelemetry.sdk.trace.export.SimpleSpanProcessorimported but unusedRemove unused import
(F401)
🤖 Prompt for AI Agents
In python/frameworks/google-adk/examples/testing_google_adk.py around lines 8 to 10, remove the unused imports OTLPSpanExporter and trace_sdk since they are not used anywhere in the example code. Keep only the imports that are actually utilized to clean up the code.python/frameworks/google-adk/traceai_google_adk/__init__.py (2)
34-40:
⚠️ Potential issueFix indentation issue in FITracer instantiation.
The indentation is incorrect and should be aligned properly:
self._tracer = cast( Tracer, - FITracer( + FITracer( trace_api.get_tracer(__name__, __version__, tracer_provider), config=config, ), )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.self._tracer = cast( Tracer, FITracer( trace_api.get_tracer(__name__, __version__, tracer_provider), config=config, ), )🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/__init__.py around lines 34 to 40, the instantiation of FITracer is incorrectly indented. Adjust the indentation so that FITracer and its parameters are properly aligned under the cast function call, ensuring consistent and clear code structure.
119-135:
⚠️ Potential issueFix incorrect import path in _unpatch_trace_tool_call.
The import path on line 121 appears to be incorrect. It should import directly from
functionsmodule rather than throughbase_llm_flow:def _unpatch_trace_tool_call(self) -> None: """Restore the original tool call tracing functionality.""" - from google.adk.flows.llm_flows.base_llm_flow import functions # type: ignore[attr-defined] + from google.adk.flows.llm_flows import functions if callable( original := getattr(functions.trace_tool_call, "__wrapped__"), # type: ignore[attr-defined] ): - from google.adk.flows.llm_flows.base_llm_flow import ( # type: ignore[attr-defined] - functions, - ) - setattr(functions, "trace_tool_call", original) from google.adk.telemetry import tracer setattr(functions, "tracer", tracer)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.def _unpatch_trace_tool_call(self) -> None: """Restore the original tool call tracing functionality.""" from google.adk.flows.llm_flows import functions if callable( original := getattr(functions.trace_tool_call, "__wrapped__"), # type: ignore[attr-defined] ): setattr(functions, "trace_tool_call", original) from google.adk.telemetry import tracer setattr(functions, "tracer", tracer)🧰 Tools
🪛 Ruff (0.11.9)
124-124: Do not call
getattrwith a constant attribute value. It is not any safer than normal property access.Replace
getattrwith attribute access(B009)
130-130: Do not call
setattrwith a constant attribute value. It is not any safer than normal property access.Replace
setattrwith assignment(B010)
134-134: Do not call
setattrwith a constant attribute value. It is not any safer than normal property access.Replace
setattrwith assignment(B010)
🪛 Pylint (3.3.7)
[error] 121-121: No name 'adk' in module 'google'
(E0611)
[error] 126-128: No name 'adk' in module 'google'
(E0611)
[error] 132-132: No name 'adk' in module 'google'
(E0611)
🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/__init__.py around lines 119 to 135, the import statement on line 121 incorrectly imports 'functions' via 'base_llm_flow'. Change the import to directly import 'functions' from its correct module path instead of through 'base_llm_flow' to fix the import path error.typescript/packages/fi-core/README.md (2)
45-60:
⚠️ Potential issueAdd missing imports to the code example.
The advanced configuration example uses
EvalTagTypeandModelChoiceswithout importing them, which would cause TypeScript compilation errors.Add the missing imports at the beginning of the code block:
-import { register, ProjectType, EvalTag, EvalName, EvalSpanKind } from '@traceai/fi-core'; +import { register, ProjectType, EvalTag, EvalName, EvalSpanKind, EvalTagType, ModelChoices } from '@traceai/fi-core';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.import { register, ProjectType, EvalTag, EvalName, EvalSpanKind, EvalTagType, ModelChoices } from '@traceai/fi-core'; // Create evaluation tags for AI model monitoring const evalTags = [ new EvalTag({ type: EvalTagType.OBSERVATION_SPAN, value: EvalSpanKind.LLM, eval_name: EvalName.CONTEXT_ADHERENCE, custom_eval_name: 'custom_context_check', mapping: { "context": "raw.input", "output": "raw.output" }, model: ModelChoices.TURING_SMALL }) ]🤖 Prompt for AI Agents
In typescript/packages/fi-core/README.md around lines 45 to 60, the code example uses EvalTagType and ModelChoices without importing them, causing TypeScript errors. Add EvalTagType and ModelChoices to the import statement from '@traceai/fi-core' at the top of the code block to fix the missing imports issue.
124-143:
⚠️ Potential issueAdd missing imports to the LLM tracing example.
The example is missing several required imports that are used in the code.
Update the import statement to include all necessary symbols:
-import { register, ProjectType } from '@traceai/fi-core'; +import { register, ProjectType, EvalTag, EvalTagType, EvalSpanKind, EvalName, ModelChoices } from '@traceai/fi-core';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.import { trace } from '@opentelemetry/api'; -import { register, ProjectType } from '@traceai/fi-core'; +import { register, ProjectType, EvalTag, EvalTagType, EvalSpanKind, EvalName, ModelChoices } from '@traceai/fi-core';🤖 Prompt for AI Agents
In typescript/packages/fi-core/README.md around lines 124 to 143, the example code for LLM tracing is missing several required imports such as EvalTag, EvalTagType, EvalSpanKind, EvalName, and ModelChoices. Update the import statements at the top of the snippet to include all these missing symbols from their respective modules so the example code can run without import errors.typescript/packages/traceai_openai/examples/manual.ts (1)
64-64: 💡 Verification agent
🧩 Analysis chain
Verify the OpenAI model name is valid.
The example uses "gpt-4o-mini" which may need verification for validity.
Also applies to: 126-126, 189-189, 223-223, 256-256
🌐 Web query:
Is "gpt-4o-mini" a valid OpenAI model name? What are the currently available OpenAI GPT-4 model variants?💡 Result:
Validity of "gpt-4o-mini" as an OpenAI Model Name
Yes, "gpt-4o-mini" is a valid OpenAI model name. This designation refers to the lightweight, cost-effective, and smaller version of the GPT-4o family—often dubbed "mini"—designed to offer strong performance at a lower cost and with reduced latency compared to the full-size GPT-4o model. Multiple sources confirm its existence and availability, both in documentation and in third-party guides[6][8][10]. For instance, OpenAI's own documentation and API references explicitly mention "gpt-4o-mini", and it is used as a model option in several platforms[8][10].
Currently Available OpenAI GPT-4 Model Variants
As of June 2025, OpenAI provides several GPT-4 family model variants, including both flagship and cost-optimized options. The main variants available are:
Model Name Description/Notes gpt-4.1 Latest flagship GPT-4 model, excels at complex tasks gpt-4.1-mini Smaller, faster, and more affordable than full GPT-4.1 gpt-4.1-nano Ultra-fast, lowest-latency model in the series gpt-4o "Omni" flagship, multimodal (text, image, audio) gpt-4o-mini Lightweight, cheaper version of GPT-4o gpt-4o-audio-preview For audio input/output tasks gpt-4.5 (limited) Advanced variant, available only in ChatGPT Plus/Pro gpt-4-turbo (phased) Fast, cost-efficient variant, used in recent years
- gpt-4.1, gpt-4.1-mini, gpt-4.1-nano: These are the newest models released in 2025 with major improvements in coding, instruction following, and context comprehension. The "mini" and "nano" variants provide speed and affordability, with "nano" optimized for the lowest latency and cost[1][2][10].
- gpt-4o and gpt-4o-mini: The GPT-4o series is OpenAI’s flagship multimodal offering, with "mini" as the budget-friendly, smaller version. Both support text and image inputs; "mini" delivers strong reasoning and multimodal API capabilities at a much lower price point[6][8][10].
- gpt-4-turbo: While prominent in 2023–2024, "turbo" models are gradually being replaced by the latest 4.1 family and "omni" models, but may still exist in some offerings[5][7].
- gpt-4.5: OpenAI’s most advanced model as of 2025, but its availability is limited to ChatGPT Plus and Pro subscriptions rather than general API access[7].
Additional Notes
- The model name "gpt-4o-mini" is sometimes aliased as "4o-mini" in API references[10].
- Other variants like "gpt-4o-audio-preview" and context-specific models (for audio or vision tasks) are available for specialized use cases[2][4][10].
- Model availability can depend on the platform (OpenAI, Azure OpenAI Service, etc.) and user subscription level.
Summary
- "gpt-4o-mini" is a valid OpenAI model name and represents a smaller, cheaper, and still highly capable version of the GPT-4o multimodal model[6][8][10].
- Currently available OpenAI GPT-4 model variants include gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, and specialized models like gpt-4o-audio-preview, alongside legacy options such as gpt-4-turbo and limited-access gpt-4.5[1][2][7][8][10].
Citations:
- 1: https://openai.com/index/gpt-4-1/
- 2: https://platform.openai.com/docs/models
- 3: https://www.brainchat.ai/blog/openai-models-2025-guide
- 4: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models
- 5: https://research.aimultiple.com/gpt4/
- 6: https://www.chatbase.co/blog/gpt-models
- 7: https://zapier.com/blog/openai-models/
- 8: https://cookbook.openai.com/examples/gpt4o/introduction_to_gpt4o
- 9: https://community.openai.com/t/chatgpt-release-notes-2025-march-27-gpt-4o-a-new-update/1153887
- 10: https://llm.datasette.io/en/stable/openai-models.html
Model name “gpt-4o-mini” is valid—no changes needed
The OpenAI model “gpt-4o-mini” is a recognized, cost-optimized GPT-4o variant as of June 2025. You can leave all instances (lines 64, 126, 189, 223, 256) unchanged.
However, the fixed 2 s
setTimeoutfor graceful shutdown may still cut off spans if they exceed that window. Consider one of the following improvements:
- Use the OpenTelemetry SDK’s
tracerProvider.shutdown()(or equivalent) to flush and close all span processors before exiting.- Increase the timeout or loop until all pending spans are exported.
- Return a promise that resolves once the exporter confirms a clean shutdown.
Locations to update:
• typescript/packages/traceai_openai/examples/manual.ts (lines 310–319)🤖 Prompt for AI Agents
In typescript/packages/traceai_openai/examples/manual.ts around lines 310 to 319, improve the graceful shutdown logic by replacing the fixed 2-second setTimeout with a proper shutdown of the OpenTelemetry tracer provider. Use the tracerProvider.shutdown() method or equivalent to ensure all spans are flushed and exported before the process exits. Alternatively, increase the timeout or implement a loop to wait until all pending spans are exported, or return a promise that resolves after a clean shutdown confirmation from the exporter.python/frameworks/google-adk/traceai_google_adk/_wrappers.py (1)
104-105: 🛠️ Refactor suggestion
Improve exception handling by catching specific exceptions.
Using bare
exceptclauses can hide unexpected errors and make debugging difficult.Consider catching specific exceptions. For JSON serialization errors:
- except Exception: - logger.exception(f"Failed to get attribute: {SpanAttributes.INPUT_VALUE}.") + except (TypeError, ValueError) as e: + logger.exception(f"Failed to serialize attribute {SpanAttributes.INPUT_VALUE}: {e}")Also applies to: 139-140, 186-187, 233-234, 327-328, 340-341, 351-351
🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/_wrappers.py around lines 104-105 and similarly at lines 139-140, 186-187, 233-234, 327-328, 340-341, and 351, the code uses bare except clauses which can obscure unexpected errors. Replace these bare except blocks with specific exception handling, such as catching JSON serialization errors (e.g., json.JSONDecodeError or TypeError) or other relevant exceptions. This will improve error clarity and debugging by only catching anticipated exceptions.
Pull Request
Description
Describe the changes in this pull request:
Checklist
Related Issues
Closes #<issue_number>
Summary by CodeRabbit
New Features
Chores
Style