phidata
phidata copied to clipboard
Passing errors to your Google search tool gets a cryptic result.
I'm trying to make the Google search tool that you offer look up error messages on Google and I don't think it's parsing it right we looked at the code and you know have to make a clean function to pass it the data right. It should have the feature so you could pass it whatever kind of string even a 1 line error for searching errors on Google and it should recognize and adapt that would be better for the end user because I know you're trying to make your library very user friendly and without needing to write you know detailed cleaning functions it'll be a lot more seamless experience
example:
import os
from phi.llm.openai import OpenAIChat
from phi.assistant import Assistant
from phi.tools.googlesearch import GoogleSearch
api_key = "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" # Replace with your actual API key
os.environ["OPENAI_API_KEY"] = api_key
model = OpenAIChat(id="gpt-4o")
assistant = Assistant(
model=model,
tools=[GoogleSearch()],
description="""This assistant specializes in looking up single-line error messages on Google to provide users with resources, guidance, and troubleshooting steps. It extracts the relevant error line from a provided error message, performs a targeted Google search, and outputs the most relevant search results that can help the user understand and resolve the error. The focus is on finding discussions, documentation, and advice from credible sources, allowing users to fix issues themselves by using the provided information.
""",
instructions=[
"""Extract the specific error line from the error message and use it as a search query on Google. The error message is typically a single line indicating what went wrong, such as \"AttributeError: 'ShaderNodeTree' object has no attribute 'outputs'.\" Search for solutions or related discussions online that address this error. Use the script content to provide context in the search query, but focus on finding relevant troubleshooting advice or documentation that could guide the user in fixing the script. Do not attempt to fix the script directly; instead, output the Google search results or a summary of the most relevant findings that can help the user resolve the issue themselves.
"""
],
markdown=True,
show_tool_calls=True,
add_datetime_to_instructions=True
)
error_message = "'AttributeError: 'ShaderNodeTree' object has no attribute 'outputs''"
assistant.print_response(error_message, stream=True)