-
Notifications
You must be signed in to change notification settings - Fork 6
updates notebooks with latest python sdk #75
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
base: main
Are you sure you want to change the base?
Conversation
Summary by CodeRabbit
WalkthroughA new "cooking-agent" module was introduced under Changes
Sequence Diagram(s)Cooking Agent Recipe Extraction and GenerationsequenceDiagram
participant User
participant CookingAgentTeam
participant ExtractionAgent
participant ChefAgent
participant Maxim (Observability)
participant FileSystem
User->>CookingAgentTeam: Provide cooking request (natural language)
CookingAgentTeam->>ExtractionAgent: Extract dish, servings, filename
ExtractionAgent-->>CookingAgentTeam: Structured extraction (JSON/model)
CookingAgentTeam->>ChefAgent: Generate recipe (using extracted info)
ChefAgent-->>CookingAgentTeam: Recipe (markdown format)
ChefAgent->>FileSystem: (Optional) Save recipe to file
ExtractionAgent->>Maxim (Observability): Log extraction completion
ChefAgent->>Maxim (Observability): Log recipe generation completion
CookingAgentTeam-->>User: Return extraction, recipe, and status
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Pylint (3.3.7)python/observability-online-eval/livekit/livekit-gemini.pypython/observability-online-eval/livekit/livekit-openai.py✨ Finishing Touches
🧪 Generate Unit Tests
🪧 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.
Actionable comments posted: 30
♻️ Duplicate comments (1)
python/observability-online-eval/langgraph/tavily-search-with-decorators.ipynb (1)
309-313: Add error handling to prevent test failures from crashing.Same as the other notebook - the test run function should handle exceptions gracefully.
async def run(row: LocalData): - response = await handle(row.get("input")) - return YieldedOutput( - data=response, - ) + try: + response = await handle(row.get("input")) + return YieldedOutput( + data=response, + ) + except Exception as e: + return YieldedOutput( + data=f"Error processing input: {str(e)}", + error=str(e), + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (5)
python/observability-online-eval/agno/cooking-agent/uv.lockis excluded by!**/*.lockpython/observability-online-eval/langgraph/files/tavily-agent.pngis excluded by!**/*.pngpython/observability-online-eval/langgraph/uv.lockis excluded by!**/*.lockpython/observability-online-eval/livekit/uv.lockis excluded by!**/*.lockpython/observability-online-eval/manual-tracing/uv.lockis excluded by!**/*.lock
📒 Files selected for processing (19)
python/observability-online-eval/agno/cooking-agent/.env.example(1 hunks)python/observability-online-eval/agno/cooking-agent/.python-version(1 hunks)python/observability-online-eval/agno/cooking-agent/README.md(1 hunks)python/observability-online-eval/agno/cooking-agent/carbonara.md(1 hunks)python/observability-online-eval/agno/cooking-agent/cooking_agent.ipynb(1 hunks)python/observability-online-eval/agno/cooking-agent/pyproject.toml(1 hunks)python/observability-online-eval/agno/cooking-agent/requirements.txt(1 hunks)python/observability-online-eval/langgraph/pyproject.toml(2 hunks)python/observability-online-eval/langgraph/tavily-search-with-decorators.ipynb(1 hunks)python/observability-online-eval/langgraph/tavily-search-without-decorators.ipynb(7 hunks)python/observability-online-eval/litellm/pyproject.toml(1 hunks)python/observability-online-eval/livekit/livekit-gemini.py(4 hunks)python/observability-online-eval/livekit/livekit-openai.py(4 hunks)python/observability-online-eval/livekit/pyproject.toml(1 hunks)python/observability-online-eval/manual-tracing/main.ipynb(5 hunks)python/observability-online-eval/manual-tracing/pyproject.toml(1 hunks)python/prompt-management/proxy_prompts_via_maxim.ipynb(3 hunks)python/prompt-management/pyproject.toml(1 hunks)python/prompt-management/retrieve_prompt_and_run.ipynb(5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
python/observability-online-eval/livekit/livekit-gemini.py (1)
python/observability-online-eval/livekit/livekit-openai.py (3)
on_event(22-33)Assistant(39-60)entrypoint(63-92)
python/observability-online-eval/livekit/livekit-openai.py (1)
python/observability-online-eval/livekit/livekit-gemini.py (2)
on_event(24-32)Assistant(38-59)
🪛 LanguageTool
python/observability-online-eval/agno/cooking-agent/carbonara.md
[uncategorized] ~14-~14: Possible missing preposition found.
Context: ...nal, for garnish) ## Instructions 1. Prepare the Sauce: In a mixing bowl, whisk to...
(AI_HYDRA_LEO_MISSING_TO)
[typographical] ~16-~16: If specifying a range, consider using an en dash instead of a hyphen.
Context: ...paghetti and cook until al dente, about 8-10 minutes. Reserve 1 cup of the pasta wat...
(HYPHEN_TO_EN)
[typographical] ~18-~18: If specifying a range, consider using an en dash instead of a hyphen.
Context: ... and cook until golden and crisp, about 4-5 minutes. Turn off the heat and add garl...
(HYPHEN_TO_EN)
[uncategorized] ~22-~22: Possible missing comma found.
Context: ... sauce is too thick, add reserved pasta water a little at a time until you reach the ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~24-~24: Possible missing comma found.
Context: ... additional grated Parmesan and chopped parsley if desired. ## Cooking Time - **Prepar...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~35-~35: Possible missing comma found.
Context: ...*: Add a splash of cream for a creamier sauce or replace Parmesan with Pecorino Roman...
(AI_HYDRA_LEO_MISSING_COMMA)
python/observability-online-eval/agno/cooking-agent/README.md
[uncategorized] ~167-~167: The preposition ‘to’ seems more likely in this position.
Context: ...docs.agno.com/) - Review the test cases in test_agent.py - Examine the agent imp...
(AI_HYDRA_LEO_REPLACE_IN_TO)
🪛 markdownlint-cli2 (0.17.2)
python/observability-online-eval/agno/cooking-agent/carbonara.md
3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
4-4: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
13-13: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
14-14: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
26-26: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
27-27: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
30-30: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
31-31: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
33-33: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
34-34: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
36-36: Files should end with a single newline character
(MD047, single-trailing-newline)
python/observability-online-eval/agno/cooking-agent/README.md
32-32: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
33-33: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
37-37: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
37-37: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
38-38: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
76-76: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
76-76: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
77-77: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
77-77: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
81-81: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
81-81: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
82-82: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
93-93: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
106-106: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
146-146: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
166-166: Lists should be surrounded by blank lines
(MD032, blanks-around-lists)
172-172: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🪛 Ruff (0.11.9)
python/observability-online-eval/livekit/livekit-gemini.py
24-24: Missing return type annotation for public function on_event
Add return type annotation: None
(ANN201)
28-28: debug() call on root logger
(LOG015)
28-28: Logging statement uses f-string
(G004)
32-32: debug() call on root logger
(LOG015)
32-32: Logging statement uses f-string
(G004)
41-41: Trailing comma missing
Add trailing comma
(COM812)
58-58: Do not catch blind exception: Exception
(BLE001)
62-62: Missing return type annotation for public function entrypoint
Add return type annotation: None
(ANN201)
79-79: Trailing comma missing
Add trailing comma
(COM812)
98-98: Trailing comma missing
Add trailing comma
(COM812)
python/observability-online-eval/livekit/livekit-openai.py
22-22: Missing return type annotation for public function on_event
Add return type annotation: None
(ANN201)
29-29: debug() call on root logger
(LOG015)
29-29: Logging statement uses f-string
(G004)
33-33: debug() call on root logger
(LOG015)
33-33: Logging statement uses f-string
(G004)
42-42: Trailing comma missing
Add trailing comma
(COM812)
59-59: Do not catch blind exception: Exception
(BLE001)
80-80: Trailing comma missing
Add trailing comma
(COM812)
🪛 Flake8 (7.2.0)
python/observability-online-eval/livekit/livekit-gemini.py
[warning] 85-85: trailing whitespace
(W291)
[warning] 89-89: trailing whitespace
(W291)
🔇 Additional comments (15)
python/observability-online-eval/langgraph/pyproject.toml (2)
14-15: Version drift:maxim-pyis pinned to 3.9.1 here but 3.9.6 elsewhere.Other sub-projects in the same repo require
maxim-py3.9.6 (some exactly, some>=).
Installing them together will trigger resolver conflicts.Choose one strategy and apply it repo-wide, e.g.:
- "maxim-py==3.9.1", + "maxim-py==3.9.6",or a caret/pep-440 range if patch flexibility is desired.
4-4:requires-pythonis too specific; blocks perfectly valid 3.10/3.11 installs.Unless you truly depend on a bug-fix released in 3.9.20, prefer a major/minor bound (
>=3.9) or a compatible range (>=3.9,<3.13).
Over-pinning harms downstream users and CI matrices.-requires-python = ">=3.9.20" +requires-python = ">=3.9"Likely an incorrect or invalid review comment.
python/observability-online-eval/litellm/pyproject.toml (1)
13-13: Align dependency spec style with other projects.Here we allow any 3.9.x ≥ 3.9.6, elsewhere it is hard-pinned. Decide whether patch upgrades are acceptable and standardise.
python/prompt-management/pyproject.toml (1)
10-10: Check Maxim-py compatibility and pin an upper version boundWe searched across the codebase for any version-specific imports or conditional logic tied to Maxim-py and found none, suggesting no obvious version checks in your Python code. However, jumping from 3.4.11 to ≥3.9.6 may introduce breaking changes. Please:
- Review the Maxim-py 3.x release notes for breaking changes or deprecated APIs.
- Pin an upper bound to avoid unintended upgrades in the future.
Location:
- python/prompt-management/pyproject.toml:10
Suggested diff:
- "maxim-py>=3.9.6", + "maxim-py>=3.9.6,<4.0.0",python/observability-online-eval/manual-tracing/main.ipynb (3)
51-53: SDK version update looks good.The update to maxim-py v3.9.6 is consistent with the PR objectives and includes enhanced logging configuration details.
77-81: Excellent improvement in trace ID handling.The addition of explicit trace ID generation using UUID is a significant improvement that prevents warnings about missing IDs. This makes the tracing more robust and predictable.
102-104: Updated LLM output reflects successful execution.The new haiku output and token usage statistics confirm that the notebook is working correctly with the updated SDK version.
python/observability-online-eval/livekit/livekit-gemini.py (2)
9-9: Good addition of image utilities import.The import of
imagesfromlivekit.agents.utilsis properly added to support the new image encoding options used later in the RealtimeModel configuration.
83-93: Excellent enhancement to RealtimeModel configuration.The comprehensive configuration of the RealtimeModel with specific modalities, language, temperature, token limits, and image encoding options significantly improves the agent's capabilities. The parameters are well-chosen for a voice AI assistant.
However, there are trailing whitespace issues that should be cleaned up:
model="gemini-2.0-flash-exp", - voice="Puck", + voice="Puck", modalities=["AUDIO"], language="en-US", temperature=0.0, - max_output_tokens=1000, + max_output_tokens=1000, image_encode_options=images.EncodeOptions( quality=85, ),python/observability-online-eval/agno/cooking-agent/.python-version (1)
1-1: Good choice of Python version.Python 3.12 is a solid choice for a new project, providing access to modern language features and good performance.
python/prompt-management/proxy_prompts_via_maxim.ipynb (2)
19-21: Environment variable loading implementation looks good.The addition of
dotenvimport andload_dotenv()call standardizes environment variable loading across the project.
49-51: Simplified Maxim SDK initialization is cleaner.The direct dictionary initialization approach is more concise than the previous Config-based approach.
python/prompt-management/retrieve_prompt_and_run.ipynb (2)
25-27: Environment variable loading implementation looks good.Consistent with the other notebook, the addition of
dotenvimport andload_dotenv()call standardizes environment variable loading.
120-120: Verify the Python version downgrade rationale.Consistent with the other notebook, the Python version metadata changed from 3.12.8 to 3.10.16. This should align with project requirements.
python/observability-online-eval/agno/cooking-agent/cooking_agent.ipynb (1)
365-392: Well-implemented type handling in callbacks.The callback functions properly handle both Pydantic models and dictionary responses, showing good defensive programming practices.
| "livekit-agents[google,openai]~=1.0", | ||
| "livekit-api>=1.0.2", | ||
| "maxim-py==3.9.0", | ||
| "maxim-py==3.9.6", |
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.
🧹 Nitpick (assertive)
Exact pin may clash with looser specs in sibling packages.
litellm uses maxim-py>=3.9.6 while this file pins ==3.9.6.
Mixed equality/inequality constraints complicate lock-file generation.
Recommend consolidating on a single == or >= rule across the monorepo.
🤖 Prompt for AI Agents
In python/observability-online-eval/livekit/pyproject.toml at line 12, the
dependency maxim-py is pinned exactly to version 3.9.6, while sibling packages
use a looser constraint (>=3.9.6). To avoid conflicts and simplify lock-file
generation, update this line to use the same version constraint style as the
other packages, either changing it to maxim-py>=3.9.6 or coordinating with other
packages to all use maxim-py==3.9.6 consistently across the monorepo.
| room = await lkapi.room.create_room( | ||
| req | ||
| ) # :contentReference[oaicite:0]{index=0} |
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.
🧹 Nitpick (assertive)
Add missing trailing commas.
room = await lkapi.room.create_room(
- req
+ req,
) # :contentReference[oaicite:0]{index=0}📝 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.
| room = await lkapi.room.create_room( | |
| req | |
| ) # :contentReference[oaicite:0]{index=0} | |
| room = await lkapi.room.create_room( | |
| req, | |
| ) # :contentReference[oaicite:0]{index=0} |
🧰 Tools
🪛 Ruff (0.11.9)
79-79: Trailing comma missing
Add trailing comma
(COM812)
🤖 Prompt for AI Agents
In python/observability-online-eval/livekit/livekit-gemini.py around lines 78 to
80, the call to lkapi.room.create_room is missing trailing commas in the
argument list. Add a trailing comma after the last argument inside the
parentheses to improve code readability and maintain consistency with Python
style guidelines.
| "@tool(show_result=True)\n", | ||
| "def write_file(filename: str, content: str) -> str:\n", | ||
| " \"\"\"Write content to a file.\"\"\"\n", | ||
| " try:\n", | ||
| " with open(filename, 'w', encoding='utf-8') as f:\n", | ||
| " f.write(content)\n", | ||
| " return f\"✅ Successfully wrote content to {filename}\"\n", | ||
| " except Exception as e:\n", | ||
| " return f\"❌ Error writing to file: {str(e)}\"\n", |
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.
Add security validation for file paths.
The write_file function accepts arbitrary file paths, which could lead to security vulnerabilities through path traversal attacks.
@tool(show_result=True)
def write_file(filename: str, content: str) -> str:
"""Write content to a file."""
try:
+ # Validate filename to prevent path traversal
+ import os.path
+ if ".." in filename or filename.startswith("/") or filename.startswith("\\"):
+ return "❌ Error: Invalid filename. Path traversal not allowed."
+
+ # Ensure file is written to a safe directory
+ safe_dir = "./recipes"
+ os.makedirs(safe_dir, exist_ok=True)
+ safe_path = os.path.join(safe_dir, os.path.basename(filename))
+
- with open(filename, 'w', encoding='utf-8') as f:
+ with open(safe_path, 'w', encoding='utf-8') as f:
f.write(content)
- return f"✅ Successfully wrote content to {filename}"
+ return f"✅ Successfully wrote content to {safe_path}"
except Exception as e:
return f"❌ Error writing to file: {str(e)}"📝 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.
| "@tool(show_result=True)\n", | |
| "def write_file(filename: str, content: str) -> str:\n", | |
| " \"\"\"Write content to a file.\"\"\"\n", | |
| " try:\n", | |
| " with open(filename, 'w', encoding='utf-8') as f:\n", | |
| " f.write(content)\n", | |
| " return f\"✅ Successfully wrote content to {filename}\"\n", | |
| " except Exception as e:\n", | |
| " return f\"❌ Error writing to file: {str(e)}\"\n", | |
| @tool(show_result=True) | |
| def write_file(filename: str, content: str) -> str: | |
| """Write content to a file.""" | |
| try: | |
| # Validate filename to prevent path traversal | |
| import os.path | |
| if ".." in filename or filename.startswith("/") or filename.startswith("\\"): | |
| return "❌ Error: Invalid filename. Path traversal not allowed." | |
| # Ensure file is written to a safe directory | |
| safe_dir = "./recipes" | |
| os.makedirs(safe_dir, exist_ok=True) | |
| safe_path = os.path.join(safe_dir, os.path.basename(filename)) | |
| with open(safe_path, 'w', encoding='utf-8') as f: | |
| f.write(content) | |
| return f"✅ Successfully wrote content to {safe_path}" | |
| except Exception as e: | |
| return f"❌ Error writing to file: {str(e)}" |
🤖 Prompt for AI Agents
In python/observability-online-eval/agno/cooking-agent/cooking_agent.ipynb
around lines 217 to 225, the write_file function currently accepts any file
path, which risks path traversal attacks. To fix this, add validation to ensure
the filename is within an allowed directory or sanitize the path to prevent
traversal outside a safe base directory. Reject or raise an error for invalid or
unsafe paths before writing the file.
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "Start tracing entire LangGraph agent using 2 simle annotations." |
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.
🧹 Nitpick (assertive)
Fix typo in documentation.
-Start tracing entire LangGraph agent using 2 simle annotations.
+Start tracing entire LangGraph agent using 2 simple annotations.📝 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.
| "Start tracing entire LangGraph agent using 2 simle annotations." | |
| "Start tracing entire LangGraph agent using 2 simple annotations." |
🤖 Prompt for AI Agents
In
python/observability-online-eval/langgraph/tavily-search-with-decorators.ipynb
at line 203, there is a typo in the documentation string: "simle" should be
corrected to "simple". Update the string to fix this spelling error.

No description provided.