Skip to content
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

Reliable Function Agent #927

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

alecsolder
Copy link
Collaborator

@alecsolder alecsolder commented Feb 12, 2025

This PR is NOT ready for review yet!

Why are these changes needed?

Related issue number

Checks

@@ -3003,7 +3005,7 @@ async def _a_wrapped_func(*args, **kwargs):
retval = await func(*args, **kwargs, **inject_params)
if logging_enabled():
log_function_use(self, func, kwargs, retval)
return serialize_to_str(retval)
return retval
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should revert this and find a way to serialise Swarm result when needed.

from inspect import Parameter, Signature, markcoroutinefunction, signature
from typing import Annotated, Any, Callable, Dict, List, Optional, Tuple, Union

from openai import BaseModel
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from openai import BaseModel
from pydantic import BaseModel


# This class relies heavily on using context_variables to store state as it is working.
# It uses the key {name}-ReliableFunctionContext as the location it writes to
__all__ = ["ReliableFunctionAgent"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

move up, just below the imports

def __init__(
self,
name: str,
runner_llm_config: dict,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
runner_llm_config: dict,
runner_llm_config: dict[str, Any],

validator_llm_config: dict,
agent_system_message: str,
validator_system_message: str,
func_or_tool: Union[Callable, Tool],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
func_or_tool: Union[Callable, Tool],
func_or_tool: Union[Callable[..., Any], Tool],

validator_system_message: str,
func_or_tool: Union[Callable, Tool],
max_rounds: int = 10,
**kwargs,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**kwargs,
**kwargs: Any,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants