-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Bug]: openai agent uses invalid tool name to lookup function #9688
Comments
🤖 Hello again, @vjr! Hope you're having a good day! Nice to see you back in the LlamaIndex repo. Let's delve into this issue. 🌟 Thank you for reporting this issue. It seems like the As a workaround, you could try to ensure that the tool names are correctly formatted before they are used in the Here's a rough example of what this could look like: def _call_function(self, function_name, *args, **kwargs):
# Ensure the tool name is correctly formatted
tool_name = function_name.split('.')[0]
if not tool_name in self.tools:
raise ValueError(f"Tool with name {tool_name} not found")
# Rest of the function... This is just a workaround and the root cause of the issue still needs to be addressed. It would be helpful if you could provide more information about the specific circumstances under which this issue occurs. For example, does it happen with all tools or only certain ones? Does it happen every time you use the This information could help us to better understand the issue and find a more permanent solution. In the meantime, I hope the workaround above can help you to avoid the Please let me know if you have any questions or if there's anything else I can do to help. You can find more information about the SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
The problem happens intermittently with the |
🤖 Based on the information you've provided, it seems like the issue you're experiencing is similar to a previously resolved issue in the LlamaIndex repository. The issue was titled [Bug]: Validation Error for tools in OpenAI Assistant Agent example and was resolved by a pull request: one line fix for wrapping of custom function tools to create OpenAI assistant. Unfortunately, the exact changes made in the pull request to resolve the issue are not detailed in the repository. However, given the title of the pull request, it seems like the issue was related to how custom function tools were being wrapped when creating the OpenAI assistant. The Given this information, it's possible that the issue you're experiencing is due to how the To resolve this issue, you might want to look into how the If you're still experiencing issues after trying these steps, please provide more information about your setup and the exact steps you're taking when the issue occurs. This will help in diagnosing and resolving the issue. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Hey, @vjr! I was trying to reproduce but was unable to. Tried several times but function (tool) names were always right. from llama_index.agent import OpenAIAgent
from llama_index.llms import OpenAI
from llama_index.tools import QueryEngineTool, ToolMetadata
from my_query_engine import query_engine # SQLTableRetrieverQueryEngine
query_engine_tools = [
QueryEngineTool(
query_engine=query_engine,
metadata=ToolMetadata(
name="Tool_A",
description="Use it for salaries stats",
),
),
QueryEngineTool(
query_engine=query_engine,
metadata=ToolMetadata(
name="Tool_B",
description="Use it for weather data",
),
),
]
llm = OpenAI(model="gpt-4-1106-preview")
agent = OpenAIAgent.from_tools(query_engine_tools, llm=llm, verbose=True)
agent.query("what about salaries and weather? ") Got output:
|
hi @stepdi yes the issue does not seem to be occurring any longer. i had monkey-patched (is that the right phrase?) a couple of the i suspect it was the openAI llm that was sending incorrect tool name and has been fixed there perhaps? thank you. |
Hi, @vjr, I'm helping the LlamaIndex team manage their backlog and am marking this issue as stale. From what I understand, the issue was reported regarding the Could you please confirm if this issue is still relevant to the latest version of the LlamaIndex repository? If it is, please let the LlamaIndex team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding and cooperation. If you have any further questions or need assistance, feel free to reach out. |
Bug Description
The
OpenAIAgent
withQueryEngineTool
s created withSQLTableRetrieverQueryEngine
s appears to look up functions using invalid tool names as in if the available tools are namedTool_A
andTool_B
it sometimes uses tool name asTool_A.Tool_A
orTool_A.Tool_B
when the intended tool name to use is justTool_A
to lookup the function.This happens with the
gpt-4-1106-preview
model but not if I usegpt-3.5-turbo
.Version
0.9.21
Steps to Reproduce
Create an
OpenAIAgent
with a few tools and run aquery()
orchat()
call to observe the problem when using thegpt-4-1106-preview
model.Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: