Find answers from the community

Updated 3 months ago

```py

Plain Text
from llama_index.agent import OpenAIAgent
from llama_hub.tools.gmail.base import GmailToolSpec
from llama_hub.tools.google_calendar.base import GoogleCalendarToolSpec
from llama_hub.tools.google_search.base import GoogleSearchToolSpec
from llama_index.tools.tool_spec.load_and_search.base import LoadAndSearchToolSpec
import openai

openai.api_key = 'api key'

gmail_tools = GmailToolSpec().to_tool_list()
gcal_tools = GoogleCalendarToolSpec().to_tool_list()
gsearch_tools = GoogleSearchToolSpec(key="api key", engine="engine").to_tool_list()


print('Wrapping ' + gsearch_tools[0].metadata.name)
gsearch_load_and_search_tools = LoadAndSearchToolSpec.from_defaults(
    gsearch_tools[0],
).to_tool_list()

print('Wrapping gmail ' + gmail_tools[0].metadata.name)
gmail_load_and_search_tools = LoadAndSearchToolSpec.from_defaults(
    gmail_tools[0],
).to_tool_list()

print('Wrapping google calendar ' + gcal_tools[0].metadata.name)
gcal_load_and_search_tools = LoadAndSearchToolSpec.from_defaults(
    gcal_tools[0],
).to_tool_list()

all_tools = [gsearch_load_and_search_tools,gmail_load_and_search_tools, gcal_load_and_search_tools,gcal_tools[1::], gmail_tools[1::],gsearch_tools[1::]]

agent = OpenAIAgent.from_tools(all_tools, verbose=True)

agent.chat('Is there any events on my calendar next week at 4pm?')

output:
Plain Text
Wrapping google_search
Wrapping gmail load_data
Wrapping google calendar load_data
=== Calling Function ===
Calling function: load_data with args: {
  "number_of_results": 10
}
Got output: Content loaded! You can now search the information using read_load_data
========================
=== Calling Function ===
Calling function: read_load_data with args: {
  "query": "events next week at 4pm"
}
Got output: There is not enough information in the given context to determine the events happening next week at 4pm.


whats the problem here
L
1 comment
What llama-index version do you have?

v0.8.0 changed the default LLM to be gpt-3.5, which in general is a bit worse than the old default of text-davinici-003 (but it's much cheaper, and also davinici is deprecated). gpt-3.5 is very... cautious when answering.

That version also introduced some newer prompts which tbh were also a bit too restrictive. Just released v0.8.2 today to try and address that.
Add a reply
Sign up and join the conversation on Discord