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

When running a tool call (tools.py), it should accept None as the argument. (Issue with end_turn tool) #378

Open
thshorrock opened this issue Nov 10, 2024 · 0 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement Enhance an existing feature

Comments

@thshorrock
Copy link

Description

I am using Qwen2.5 as my llm. When calling the end_turn tool in multiagent tasks, the "end_turn" tool is called with None for the arguments, rather than an empty dictionary as is done with gpt.

This causes this error:

| ERROR | Task run 'Tool call: end_turn' - Task run failed with exception: TypeError('controlflow.orchestration.turn_strategies.get_end_turn_tool..end_turn() argument after ** must be a mapping, not NoneType') - Retries are exhausted Traceback (most recent call last): controlflow

The issue is this part of the file tools/tools.py (around line 60)

    @prefect_task(task_run_name="Tool call: {self.name}")
    def run(self, input: dict):
        
        result = self.fn(**input)

This issue is resolved if a check for None is added:


    @prefect_task(task_run_name="Tool call: {self.name}")
    def run(self, input: dict):
    
        # Set input to an empty dictionary if it is None
        input = input or {} 
        
        result = self.fn(**input)

Example Code

import controlflow as cf

model = ChatOpenAI(temperature=0.0, model="Qwen/Qwen2.5-7B-Instruct",  base_url="my-vllm-server/v1")

optimist = cf.Agent(
    name="Optimist",
    instructions="Always find the best in every situation.", 
    model=model
)

pessimist = cf.Agent(
    name="Pessimist",
    instructions="Always find the worst in every situation.",
    model=model
)

cf.run(
    f"Debate world peace",
    instructions=(
        "Mark the task successful once both agents have have spoken"
    ),
    agents=[optimist, pessimist],
)

Version Information

control flow version: 0.11.2
python 3.11.0

Additional Context

No response

@thshorrock thshorrock added the bug Something isn't working label Nov 10, 2024
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement Enhance an existing feature labels Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement Enhance an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant