Open aspirant2018 opened 4 weeks ago
and when I used it as aZoneInfo object:
from zoneinfo import ZoneInfo
from datetime import datetime
# Create a ZoneInfo object for a specific timezone, for example, 'America/New_York'
ny_timezone = ZoneInfo("UTC")
# Get the current time in the specified timezone
current_time = datetime.now(ny_timezone)
print("Current time in UTC:", current_time)
answer = agent_events.invoke(
f"Can you make a 30 minute meeting with a sentient parrot to discuss research collaborations on {current_time}?"
)
print(answer['output'])
I got this output
> Entering new AgentExecutor chain...
Invoking: `events_search` with `{'start_datetime': '2024-06-07T13:00:00+00:00', 'end_datetime': '2024-06-07T14:00:00+00:00'}`
[]
Invoking: `send_event` with `{'body': 'Discuss research collaborations with a sentient parrot.', 'attendees': ['[sentientparrot@example.com](mailto:sentientparrot@example.com)'], 'subject': 'Research Collaborations Meeting', 'start_datetime': '2024-06-07T13:21:17.628675+00:00', 'end_datetime': '2024-06-07T13:51:17.628675+00:00'}`
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-272-4eafbd13a3f4>](https://localhost:8080/#) in <cell line: 12>()
10 print("Current time in UTC:", current_time)
11
---> 12 answer = agent_events.invoke(
13 f"Can you make a 30 minute meeting with a sentient parrot to discuss research collaborations on {current_time}?"
14 )
11 frames
[/usr/lib/python3.10/_strptime.py](https://localhost:8080/#) in _strptime(data_string, format)
347 found = format_regex.match(data_string)
348 if not found:
--> 349 raise ValueError("time data %r does not match format %r" %
350 (data_string, format))
351 if len(data_string) != found.end():
ValueError: time data '2024-06-07T13:21:17.628675+00:00' does not match format '%Y-%m-%dT%H:%M:%S%z'
I don't see in your traceback what O365 call is giving this error.
If you just create the event using the same params by code... works?
Hello , thank you for replying to me .
so when i excute this code:
answer = agent_events.invoke(
f"add an event at 2024-06-07 at 12:00:00 PM to recall John ?"
)
print(answer['output'])
I got this error
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: should_run_async
will not call transform_cell
automatically in the future. Please pass the result to transformed_cell
argument and any exception that happen during thetransform in preprocessing_exc_tuple
in IPython 7.17 and above.
def _forward_input(self, allow_stdin=False):
Entering new AgentExecutor chain...
Invoking: send_event
with {'body': 'Reminder to recall John', 'attendees': ['John'], 'subject': 'Recall John', 'start_datetime': '2024-06-07T12:00:00+00:00', 'end_datetime': '2024-06-07T13:00:00+00:00'}
ValueError Traceback (most recent call last)
10 frames
/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py in invoke(self, input, config, **kwargs) 164 except BaseException as e: 165 run_manager.on_chain_error(e) --> 166 raise e 167 run_manager.on_chain_end(outputs) 168
/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py in invoke(self, input, config, **kwargs) 154 self._validate_inputs(inputs) 155 outputs = ( --> 156 self._call(inputs, run_manager=run_manager) 157 if new_arg_supported 158 else self._call(inputs)
/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py in _call(self, inputs, run_manager) 1431 # We now enter the agent loop (until it returns something). 1432 while self._should_continue(iterations, time_elapsed): -> 1433 next_step_output = self._take_next_step( 1434 name_to_tool_map, 1435 color_mapping,
/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py in _take_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager) 1137 ) -> Union[AgentFinish, List[Tuple[AgentAction, str]]]: 1138 return self._consume_next_step( -> 1139 [ 1140 a 1141 for a in self._iter_next_step(
/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py in
/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py in _iter_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager) 1222 yield agent_action 1223 for agent_action in actions: -> 1224 yield self._perform_agent_action( 1225 name_to_tool_map, color_mapping, agent_action, run_manager 1226 )
/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py in _perform_agent_action(self, name_to_tool_map, color_mapping, agent_action, run_manager) 1244 tool_run_kwargs["llm_prefix"] = "" 1245 # We then call the tool on the tool input to get an observation -> 1246 observation = tool.run( 1247 agent_action.tool_input, 1248 verbose=self.verbose,
/usr/local/lib/python3.10/dist-packages/langchain_core/tools.py in run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, kwargs) 450 except (Exception, KeyboardInterrupt) as e: 451 run_manager.on_tool_error(e) --> 452 raise e 453 else: 454 run_manager.on_tool_end(observation, color=color, name=self.name, kwargs)
/usr/local/lib/python3.10/dist-packages/langchain_core/tools.py in run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, *kwargs) 407 tool_args, tool_kwargs = self._to_args_and_kwargs(parsed_input) 408 observation = ( --> 409 context.run( 410 self._run, tool_args, run_manager=run_manager, **tool_kwargs 411 )
/usr/local/lib/python3.10/dist-packages/langchain_community/tools/office365/send_event.py in _run(self, body, attendees, subject, start_datetime, end_datetime, run_manager) 74 event.body = body 75 event.subject = subject ---> 76 event.start = dt.strptime(start_datetime, UTC_FORMAT) 77 event.end = dt.strptime(end_datetime, UTC_FORMAT) 78 for attendee in attendees:
/usr/local/lib/python3.10/dist-packages/O365/calendar.py in start(self, value) 1070 else: 1071 if not isinstance(value.tzinfo, ZoneInfo): -> 1072 raise ValueError('TimeZone data must be set using ZoneInfo objects') 1073 self.__start = value 1074 if not self.end:
ValueError: TimeZone data must be set using ZoneInfo objects
Hey guys, I have created an agent using 365 toolkits to interact with my calender. the authentification and extracting events works fine. example:![Capture d’écran 2024-06-07 à 14 36 08](https://github.com/O365/python-o365/assets/42543749/8866d90b-626b-492f-9eb4-704ec2c0af39)
the result: I found an upcoming event in your calendar for June 2024:
If you need more information or assistance with this event, feel free to let me know! The problem occurs when I want to insert a new event that's when I got this error:
ValueError: TimeZone data must be set using ZoneInfo objects