Skip to content

allow custom handlers and prompts in functions#1125

Merged
zzstoatzz merged 2 commits into
mainfrom
custom
Apr 25, 2025
Merged

allow custom handlers and prompts in functions#1125
zzstoatzz merged 2 commits into
mainfrom
custom

Conversation

@zzstoatzz

@zzstoatzz zzstoatzz commented Apr 25, 2025

Copy link
Copy Markdown
Collaborator

closes #1124 (see this example)

also see new examples

  • custom handler to show whatever you want in the console
  • custom prompts to add onto or replace the default prompts for the high level utils

Copilot AI review requested due to automatic review settings April 25, 2025 07:11
@github-actions github-actions Bot added documentation Improvements or additions to documentation example tests labels Apr 25, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables the use of custom handlers and prompts in functions while modernizing type annotations and agent interactions across several examples. Key changes include:

  • Adding type annotations and inline type ignores where needed (e.g. in record_audio).
  • Introducing a new custom handler (ShowPromptHandler) and updating agent tool configurations.
  • Replacing legacy agent tool examples with updated asynchronous implementations and prompt string adjustments.

Reviewed Changes

Copilot reviewed 23 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
examples/talk_to_marvin.py Added type annotations to record_audio and updated the pyaudio import comment.
examples/slackbot/search.py Added explicit type annotation for the results variable.
examples/provider_specific/openai/run_agent.py Updated the agent initialization with provider-based API configuration.
examples/hello_task.py Updated the task instantiation with a generic type parameter.
examples/hello_fn.py Updated the function decorator to include a prompt argument.
examples/hello_agent.py Refactored the file functions and adjusted the agent’s prompt string.
examples/deepseek_chat.py Switched to asynchronous agent execution using run_async.
examples/custom_handler.py Added a custom handler that prints the initial user prompt.
examples/agent_uses_tools.py Removed redundant agent tool usage in favor of updated implementations.
Files not reviewed (10)
  • .cursor/rules/python-style.mdc: Language not supported
  • docs/api-reference/marvin-agents-agent.mdx: Language not supported
  • docs/api-reference/marvin-fns-cast.mdx: Language not supported
  • docs/api-reference/marvin-fns-classify.mdx: Language not supported
  • docs/api-reference/marvin-fns-extract.mdx: Language not supported
  • docs/api-reference/marvin-fns-fn.mdx: Language not supported
  • docs/api-reference/marvin-fns-generate.mdx: Language not supported
  • docs/api-reference/marvin-fns-say.mdx: Language not supported
  • docs/api-reference/marvin-fns-summarize.mdx: Language not supported
  • docs/api-reference/marvin-handlers-queue_handler.mdx: Language not supported

Comment thread examples/hello_agent.py
@github-actions github-actions Bot added enhancement New feature or request feature Pull requests that add features labels Apr 25, 2025
@zzstoatzz zzstoatzz merged commit b04f1e5 into main Apr 25, 2025
@zzstoatzz zzstoatzz deleted the custom branch April 25, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request example feature Pull requests that add features tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any way to debug the LLM prompt that was passed?

2 participants