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

Tool Usage Blocked After Message Output #56

Closed
VRSEN opened this issue Jun 28, 2024 · 2 comments
Closed

Tool Usage Blocked After Message Output #56

VRSEN opened this issue Jun 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working fixed-waiting-user-feedback

Comments

@VRSEN
Copy link

VRSEN commented Jun 28, 2024

Description

When using the Astra Assistants API, there is an issue where the execution stops if the assistant outputs a message before using a tool. In the OpenAI Assistants API, the agent can output a message and then use a tool subsequently. However, with Astra Assistants, if the agent outputs any message, the execution stops and prevents further tool usage. The execution works correctly if the agent uses tools before outputting any message.

Steps to Reproduce

  1. Create an assistant using the Astra Assistants API.
  2. Instruct the assistant to output a message and then use a tool: "You must say 'I am using test tool' and then use test tool in this exact order in a single message. Do not use test tool before you said you are using it."
  3. Observe that the execution stops after the message is outputted, and the tool is not used.

Expected Behavior

The assistant should be able to output a message and then use a tool seamlessly, as it works in the OpenAI Assistants API.

Actual Behavior

The execution stops after the assistant outputs a message, preventing any subsequent tool usage.

Example

from openai import OpenAI
from astra_assistants import patch
from agency_swarm import Agent, Agency, set_openai_client
from dotenv import load_dotenv
from agency_swarm.tools import BaseTool

load_dotenv('../.env')

client = patch(OpenAI())

set_openai_client(client)

class TestTool(BaseTool):
    """
    A simple tool that prints 'test'.
    """

    def run(self):
        """
        This method prints the word 'test'.
        """
        print("test")
        return "Test has been printed."

ceo = Agent(name="Test Agent",
            description="Test Agent for testing purposes",
            instructions="You must say 'I am using test tool' and then use test tool in the same message.",
            # model="perplexity/llama-3-8b-instruct",
            # model="anthropic/claude-3-haiku-20240307",
            # model="groq/mixtral-8x7b-32768",
            model="gpt-4o",
            # files_folder="./examples/python/agency-swarm/files",
            temperature=0,
            tools=[TestTool])

agency = Agency([ceo])
 
completion = agency.get_completion("Please say 'I am using test tool' and ONLY THEN use test tool.")
print(completion)

Environment

  • Agency Swarm version: 0.2.5
  • Astra Assistants version: 2.0.5

Additional Information

  • The issue does not occur if tools are used before outputting any message.
@phact phact self-assigned this Jun 28, 2024
@phact phact added the bug Something isn't working label Jun 28, 2024
@phact
Copy link
Collaborator

phact commented Jun 29, 2024

Fixed in v0.2.14
Shipped to dockerhub and to the service

@phact
Copy link
Collaborator

phact commented Jul 10, 2024

Closing as fixed

@phact phact closed this as completed Jul 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 fixed-waiting-user-feedback
2 participants