Spaces:
Sleeping
Sleeping
Commit
·
40babd7
1
Parent(s):
d438f6e
this is the one that hit
Browse files- __pycache__/graph.cpython-313.pyc +0 -0
- app.log +371 -0
- graph.png +0 -0
- graph.py +121 -0
__pycache__/graph.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/graph.cpython-313.pyc and b/__pycache__/graph.cpython-313.pyc differ
|
|
|
app.log
CHANGED
|
@@ -54372,3 +54372,374 @@ generated_image_url_from_dalle
|
|
| 54372 |
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54373 |
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54374 |
During task with name 'prompt_planning_node' and id '6a9d734e-45cb-d263-138f-1c8d99909d3c'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54372 |
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54373 |
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54374 |
During task with name 'prompt_planning_node' and id '6a9d734e-45cb-d263-138f-1c8d99909d3c'
|
| 54375 |
+
2025-06-10 17:53:34:__main__:INFO: Starting the interface
|
| 54376 |
+
2025-06-10 17:53:48:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54377 |
+
2025-06-10 17:53:57:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54378 |
+
2025-06-10 17:54:06:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54379 |
+
2025-06-10 17:54:14:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54380 |
+
2025-06-10 17:54:25:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54381 |
+
2025-06-10 18:19:44:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54382 |
+
2025-06-10 18:19:44:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54383 |
+
2025-06-10 18:20:59:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54384 |
+
2025-06-10 18:20:59:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54385 |
+
2025-06-10 18:24:18:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54386 |
+
2025-06-10 18:24:25:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54387 |
+
2025-06-10 18:24:26:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54388 |
+
2025-06-10 18:24:34:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54389 |
+
2025-06-10 18:24:43:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54390 |
+
2025-06-10 18:24:43:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54391 |
+
2025-06-10 18:24:51:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54392 |
+
2025-06-10 18:25:28:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54393 |
+
2025-06-10 18:26:11:__main__:INFO: Starting the interface
|
| 54394 |
+
2025-06-10 18:26:23:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54395 |
+
2025-06-10 18:26:34:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54396 |
+
2025-06-10 18:26:53:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54397 |
+
2025-06-10 18:27:11:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54398 |
+
2025-06-10 18:27:25:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54399 |
+
2025-06-10 18:27:49:__main__:ERROR: Exception occurred
|
| 54400 |
+
Traceback (most recent call last):
|
| 54401 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54402 |
+
async for stream_mode, chunk in graph.astream(
|
| 54403 |
+
...<56 lines>...
|
| 54404 |
+
yield output, gr.skip(), gr.skip()
|
| 54405 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2652, in astream
|
| 54406 |
+
while loop.tick(input_keys=self.input_channels):
|
| 54407 |
+
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54408 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\loop.py", line 493, in tick
|
| 54409 |
+
mv_writes, updated_channels = apply_writes(
|
| 54410 |
+
~~~~~~~~~~~~^
|
| 54411 |
+
self.checkpoint,
|
| 54412 |
+
^^^^^^^^^^^^^^^^
|
| 54413 |
+
...<3 lines>...
|
| 54414 |
+
self.trigger_to_nodes,
|
| 54415 |
+
^^^^^^^^^^^^^^^^^^^^^^
|
| 54416 |
+
)
|
| 54417 |
+
^
|
| 54418 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\algo.py", line 305, in apply_writes
|
| 54419 |
+
if channels[chan].update(vals) and get_next_version is not None:
|
| 54420 |
+
~~~~~~~~~~~~~~~~~~~~~^^^^^^
|
| 54421 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\channels\last_value.py", line 58, in update
|
| 54422 |
+
raise InvalidUpdateError(msg)
|
| 54423 |
+
langgraph.errors.InvalidUpdateError: At key 'next_stage': Can receive only one value per step. Use an Annotated key to handle multiple values.
|
| 54424 |
+
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/INVALID_CONCURRENT_GRAPH_UPDATE
|
| 54425 |
+
2025-06-10 18:28:59:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54426 |
+
2025-06-10 18:28:59:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54427 |
+
2025-06-10 18:29:32:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54428 |
+
2025-06-10 18:29:32:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54429 |
+
2025-06-10 18:29:40:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54430 |
+
2025-06-10 18:30:34:__main__:INFO: Starting the interface
|
| 54431 |
+
2025-06-10 18:30:39:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54432 |
+
2025-06-10 18:30:46:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54433 |
+
2025-06-10 18:31:01:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54434 |
+
2025-06-10 18:31:39:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54435 |
+
2025-06-10 18:32:06:__main__:ERROR: Exception occurred
|
| 54436 |
+
Traceback (most recent call last):
|
| 54437 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54438 |
+
async for stream_mode, chunk in graph.astream(
|
| 54439 |
+
...<56 lines>...
|
| 54440 |
+
yield output, gr.skip(), gr.skip()
|
| 54441 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2655, in astream
|
| 54442 |
+
async for _ in runner.atick(
|
| 54443 |
+
...<7 lines>...
|
| 54444 |
+
yield o
|
| 54445 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 400, in atick
|
| 54446 |
+
_panic_or_proceed(
|
| 54447 |
+
~~~~~~~~~~~~~~~~~^
|
| 54448 |
+
futures.done.union(f for f, t in futures.items() if t is not None),
|
| 54449 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54450 |
+
timeout_exc_cls=asyncio.TimeoutError,
|
| 54451 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54452 |
+
panic=reraise,
|
| 54453 |
+
^^^^^^^^^^^^^^
|
| 54454 |
+
)
|
| 54455 |
+
^
|
| 54456 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 509, in _panic_or_proceed
|
| 54457 |
+
raise exc
|
| 54458 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\retry.py", line 136, in arun_with_retry
|
| 54459 |
+
return await task.proc.ainvoke(task.input, config)
|
| 54460 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54461 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 678, in ainvoke
|
| 54462 |
+
input = await step.ainvoke(input, config)
|
| 54463 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54464 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 440, in ainvoke
|
| 54465 |
+
ret = await self.afunc(*args, **kwargs)
|
| 54466 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54467 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\branch.py", line 185, in _aroute
|
| 54468 |
+
value = reader(config)
|
| 54469 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\read.py", line 110, in do_read
|
| 54470 |
+
return mapper(read(select, fresh))
|
| 54471 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\state.py", line 1050, in _coerce_state
|
| 54472 |
+
return schema(**input)
|
| 54473 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\pydantic\main.py", line 214, in __init__
|
| 54474 |
+
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
|
| 54475 |
+
pydantic_core._pydantic_core.ValidationError: 1 validation error for GraphProcessingState
|
| 54476 |
+
generated_image_url_from_dalle
|
| 54477 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54478 |
+
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54479 |
+
During task with name 'prompt_planning_node' and id 'ba788899-a21c-7c86-6067-02aac28f178b'
|
| 54480 |
+
2025-06-10 18:42:10:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54481 |
+
2025-06-10 18:42:10:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54482 |
+
2025-06-10 18:42:10:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54483 |
+
2025-06-10 18:42:35:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54484 |
+
2025-06-10 18:43:17:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54485 |
+
2025-06-10 18:43:17:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54486 |
+
2025-06-10 18:47:25:__main__:INFO: Starting the interface
|
| 54487 |
+
2025-06-10 18:47:50:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54488 |
+
2025-06-10 18:48:14:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54489 |
+
2025-06-10 18:48:27:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54490 |
+
2025-06-10 18:48:41:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54491 |
+
2025-06-10 18:48:54:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54492 |
+
2025-06-10 18:49:06:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54493 |
+
2025-06-10 18:49:32:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54494 |
+
2025-06-10 18:51:50:__main__:ERROR: Exception occurred
|
| 54495 |
+
Traceback (most recent call last):
|
| 54496 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54497 |
+
async for stream_mode, chunk in graph.astream(
|
| 54498 |
+
...<56 lines>...
|
| 54499 |
+
yield output, gr.skip(), gr.skip()
|
| 54500 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2655, in astream
|
| 54501 |
+
async for _ in runner.atick(
|
| 54502 |
+
...<7 lines>...
|
| 54503 |
+
yield o
|
| 54504 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 400, in atick
|
| 54505 |
+
_panic_or_proceed(
|
| 54506 |
+
~~~~~~~~~~~~~~~~~^
|
| 54507 |
+
futures.done.union(f for f, t in futures.items() if t is not None),
|
| 54508 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54509 |
+
timeout_exc_cls=asyncio.TimeoutError,
|
| 54510 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54511 |
+
panic=reraise,
|
| 54512 |
+
^^^^^^^^^^^^^^
|
| 54513 |
+
)
|
| 54514 |
+
^
|
| 54515 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 509, in _panic_or_proceed
|
| 54516 |
+
raise exc
|
| 54517 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\retry.py", line 136, in arun_with_retry
|
| 54518 |
+
return await task.proc.ainvoke(task.input, config)
|
| 54519 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54520 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 678, in ainvoke
|
| 54521 |
+
input = await step.ainvoke(input, config)
|
| 54522 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54523 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 440, in ainvoke
|
| 54524 |
+
ret = await self.afunc(*args, **kwargs)
|
| 54525 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54526 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\branch.py", line 185, in _aroute
|
| 54527 |
+
value = reader(config)
|
| 54528 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\read.py", line 110, in do_read
|
| 54529 |
+
return mapper(read(select, fresh))
|
| 54530 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\state.py", line 1050, in _coerce_state
|
| 54531 |
+
return schema(**input)
|
| 54532 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\pydantic\main.py", line 214, in __init__
|
| 54533 |
+
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
|
| 54534 |
+
pydantic_core._pydantic_core.ValidationError: 1 validation error for GraphProcessingState
|
| 54535 |
+
generated_image_url_from_dalle
|
| 54536 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54537 |
+
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54538 |
+
During task with name 'prompt_planning_node' and id '6eac4045-a372-ef04-7eff-3052a9c5e7f9'
|
| 54539 |
+
2025-06-10 18:53:34:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54540 |
+
2025-06-10 18:54:43:__main__:INFO: Starting the interface
|
| 54541 |
+
2025-06-10 18:54:48:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54542 |
+
2025-06-10 18:54:53:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54543 |
+
2025-06-10 18:55:15:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54544 |
+
2025-06-10 18:55:38:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54545 |
+
2025-06-10 18:55:44:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54546 |
+
2025-06-10 18:56:13:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54547 |
+
2025-06-10 18:56:31:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54548 |
+
2025-06-10 18:57:23:__main__:ERROR: Exception occurred
|
| 54549 |
+
Traceback (most recent call last):
|
| 54550 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54551 |
+
async for stream_mode, chunk in graph.astream(
|
| 54552 |
+
...<56 lines>...
|
| 54553 |
+
yield output, gr.skip(), gr.skip()
|
| 54554 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2655, in astream
|
| 54555 |
+
async for _ in runner.atick(
|
| 54556 |
+
...<7 lines>...
|
| 54557 |
+
yield o
|
| 54558 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 400, in atick
|
| 54559 |
+
_panic_or_proceed(
|
| 54560 |
+
~~~~~~~~~~~~~~~~~^
|
| 54561 |
+
futures.done.union(f for f, t in futures.items() if t is not None),
|
| 54562 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54563 |
+
timeout_exc_cls=asyncio.TimeoutError,
|
| 54564 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54565 |
+
panic=reraise,
|
| 54566 |
+
^^^^^^^^^^^^^^
|
| 54567 |
+
)
|
| 54568 |
+
^
|
| 54569 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 509, in _panic_or_proceed
|
| 54570 |
+
raise exc
|
| 54571 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\retry.py", line 136, in arun_with_retry
|
| 54572 |
+
return await task.proc.ainvoke(task.input, config)
|
| 54573 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54574 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 678, in ainvoke
|
| 54575 |
+
input = await step.ainvoke(input, config)
|
| 54576 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54577 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 440, in ainvoke
|
| 54578 |
+
ret = await self.afunc(*args, **kwargs)
|
| 54579 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54580 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\branch.py", line 185, in _aroute
|
| 54581 |
+
value = reader(config)
|
| 54582 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\read.py", line 110, in do_read
|
| 54583 |
+
return mapper(read(select, fresh))
|
| 54584 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\state.py", line 1050, in _coerce_state
|
| 54585 |
+
return schema(**input)
|
| 54586 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\pydantic\main.py", line 214, in __init__
|
| 54587 |
+
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
|
| 54588 |
+
pydantic_core._pydantic_core.ValidationError: 1 validation error for GraphProcessingState
|
| 54589 |
+
generated_image_url_from_dalle
|
| 54590 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54591 |
+
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54592 |
+
During task with name 'prompt_planning_node' and id 'c9117536-3169-af11-e785-1c7cea3c2c62'
|
| 54593 |
+
2025-06-10 19:00:21:__main__:INFO: Starting the interface
|
| 54594 |
+
2025-06-10 19:00:44:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54595 |
+
2025-06-10 19:01:29:__main__:INFO: Starting the interface
|
| 54596 |
+
2025-06-10 19:01:45:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54597 |
+
2025-06-10 19:02:00:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54598 |
+
2025-06-10 19:02:14:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54599 |
+
2025-06-10 19:02:24:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54600 |
+
2025-06-10 19:02:46:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54601 |
+
2025-06-10 19:03:38:__main__:ERROR: Exception occurred
|
| 54602 |
+
Traceback (most recent call last):
|
| 54603 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54604 |
+
async for stream_mode, chunk in graph.astream(
|
| 54605 |
+
...<56 lines>...
|
| 54606 |
+
yield output, gr.skip(), gr.skip()
|
| 54607 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2655, in astream
|
| 54608 |
+
async for _ in runner.atick(
|
| 54609 |
+
...<7 lines>...
|
| 54610 |
+
yield o
|
| 54611 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 400, in atick
|
| 54612 |
+
_panic_or_proceed(
|
| 54613 |
+
~~~~~~~~~~~~~~~~~^
|
| 54614 |
+
futures.done.union(f for f, t in futures.items() if t is not None),
|
| 54615 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54616 |
+
timeout_exc_cls=asyncio.TimeoutError,
|
| 54617 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54618 |
+
panic=reraise,
|
| 54619 |
+
^^^^^^^^^^^^^^
|
| 54620 |
+
)
|
| 54621 |
+
^
|
| 54622 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 509, in _panic_or_proceed
|
| 54623 |
+
raise exc
|
| 54624 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\retry.py", line 136, in arun_with_retry
|
| 54625 |
+
return await task.proc.ainvoke(task.input, config)
|
| 54626 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54627 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 678, in ainvoke
|
| 54628 |
+
input = await step.ainvoke(input, config)
|
| 54629 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54630 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 440, in ainvoke
|
| 54631 |
+
ret = await self.afunc(*args, **kwargs)
|
| 54632 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54633 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\branch.py", line 185, in _aroute
|
| 54634 |
+
value = reader(config)
|
| 54635 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\read.py", line 110, in do_read
|
| 54636 |
+
return mapper(read(select, fresh))
|
| 54637 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\state.py", line 1050, in _coerce_state
|
| 54638 |
+
return schema(**input)
|
| 54639 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\pydantic\main.py", line 214, in __init__
|
| 54640 |
+
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
|
| 54641 |
+
pydantic_core._pydantic_core.ValidationError: 1 validation error for GraphProcessingState
|
| 54642 |
+
generated_image_url_from_dalle
|
| 54643 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54644 |
+
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54645 |
+
During task with name 'prompt_planning_node' and id '0b2c5f03-8dbb-6f3d-d087-e32905c66861'
|
| 54646 |
+
2025-06-10 19:13:18:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54647 |
+
2025-06-10 19:13:18:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54648 |
+
2025-06-10 19:14:35:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54649 |
+
2025-06-10 19:14:35:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54650 |
+
2025-06-10 19:17:48:__main__:INFO: Starting the interface
|
| 54651 |
+
2025-06-10 19:18:03:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54652 |
+
2025-06-10 19:18:03:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54653 |
+
2025-06-10 19:18:39:__main__:INFO: Starting the interface
|
| 54654 |
+
2025-06-10 19:18:51:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54655 |
+
2025-06-10 19:19:06:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54656 |
+
2025-06-10 19:19:25:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54657 |
+
2025-06-10 19:19:44:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54658 |
+
2025-06-10 19:19:58:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54659 |
+
2025-06-10 19:20:06:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54660 |
+
2025-06-10 19:20:21:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54661 |
+
2025-06-10 19:21:07:__main__:ERROR: Exception occurred
|
| 54662 |
+
Traceback (most recent call last):
|
| 54663 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54664 |
+
async for stream_mode, chunk in graph.astream(
|
| 54665 |
+
...<56 lines>...
|
| 54666 |
+
yield output, gr.skip(), gr.skip()
|
| 54667 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2655, in astream
|
| 54668 |
+
async for _ in runner.atick(
|
| 54669 |
+
...<7 lines>...
|
| 54670 |
+
yield o
|
| 54671 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 400, in atick
|
| 54672 |
+
_panic_or_proceed(
|
| 54673 |
+
~~~~~~~~~~~~~~~~~^
|
| 54674 |
+
futures.done.union(f for f, t in futures.items() if t is not None),
|
| 54675 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54676 |
+
timeout_exc_cls=asyncio.TimeoutError,
|
| 54677 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54678 |
+
panic=reraise,
|
| 54679 |
+
^^^^^^^^^^^^^^
|
| 54680 |
+
)
|
| 54681 |
+
^
|
| 54682 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\runner.py", line 509, in _panic_or_proceed
|
| 54683 |
+
raise exc
|
| 54684 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\retry.py", line 136, in arun_with_retry
|
| 54685 |
+
return await task.proc.ainvoke(task.input, config)
|
| 54686 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54687 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 678, in ainvoke
|
| 54688 |
+
input = await step.ainvoke(input, config)
|
| 54689 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54690 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\utils\runnable.py", line 440, in ainvoke
|
| 54691 |
+
ret = await self.afunc(*args, **kwargs)
|
| 54692 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 54693 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\branch.py", line 185, in _aroute
|
| 54694 |
+
value = reader(config)
|
| 54695 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\read.py", line 110, in do_read
|
| 54696 |
+
return mapper(read(select, fresh))
|
| 54697 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\graph\state.py", line 1050, in _coerce_state
|
| 54698 |
+
return schema(**input)
|
| 54699 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\pydantic\main.py", line 214, in __init__
|
| 54700 |
+
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
|
| 54701 |
+
pydantic_core._pydantic_core.ValidationError: 1 validation error for GraphProcessingState
|
| 54702 |
+
generated_image_url_from_dalle
|
| 54703 |
+
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
|
| 54704 |
+
For further information visit https://errors.pydantic.dev/2.10/v/string_type
|
| 54705 |
+
During task with name 'prompt_planning_node' and id '334bcc8d-b6ee-7499-28ac-091333bdcb02'
|
| 54706 |
+
2025-06-10 19:27:35:__main__:INFO: Starting the interface
|
| 54707 |
+
2025-06-10 19:27:42:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54708 |
+
2025-06-10 19:28:25:__main__:INFO: Starting the interface
|
| 54709 |
+
2025-06-10 19:28:28:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54710 |
+
2025-06-10 19:29:38:__main__:INFO: Starting the interface
|
| 54711 |
+
2025-06-10 19:29:43:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54712 |
+
2025-06-10 19:30:15:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54713 |
+
2025-06-10 19:30:25:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54714 |
+
2025-06-10 19:30:39:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54715 |
+
2025-06-10 19:31:20:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54716 |
+
2025-06-10 19:31:54:__main__:ERROR: Exception occurred
|
| 54717 |
+
Traceback (most recent call last):
|
| 54718 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54719 |
+
async for stream_mode, chunk in graph.astream(
|
| 54720 |
+
...<56 lines>...
|
| 54721 |
+
yield output, gr.skip(), gr.skip()
|
| 54722 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2677, in astream
|
| 54723 |
+
raise GraphRecursionError(msg)
|
| 54724 |
+
langgraph.errors.GraphRecursionError: Recursion limit of 20 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.
|
| 54725 |
+
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT
|
| 54726 |
+
2025-06-10 19:32:17:__main__:INFO: Starting the interface
|
| 54727 |
+
2025-06-10 19:32:23:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54728 |
+
2025-06-10 19:33:05:__main__:INFO: Starting the interface
|
| 54729 |
+
2025-06-10 19:33:12:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
| 54730 |
+
2025-06-10 19:33:27:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54731 |
+
2025-06-10 19:33:39:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54732 |
+
2025-06-10 19:33:59:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54733 |
+
2025-06-10 19:34:10:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54734 |
+
2025-06-10 19:34:46:__main__:INFO: Prompt: You are a helpful assistant.
|
| 54735 |
+
2025-06-10 19:37:15:__main__:ERROR: Exception occurred
|
| 54736 |
+
Traceback (most recent call last):
|
| 54737 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\the_backup2\dev\DIY_assistant\app.py", line 115, in chat_fn
|
| 54738 |
+
async for stream_mode, chunk in graph.astream(
|
| 54739 |
+
...<56 lines>...
|
| 54740 |
+
yield output, gr.skip(), gr.skip()
|
| 54741 |
+
File "C:\myworkspace\huggingface_agents\mcp-hackthon\dev\DIY_assistant\env\Lib\site-packages\langgraph\pregel\__init__.py", line 2677, in astream
|
| 54742 |
+
raise GraphRecursionError(msg)
|
| 54743 |
+
langgraph.errors.GraphRecursionError: Recursion limit of 20 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.
|
| 54744 |
+
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/GRAPH_RECURSION_LIMIT
|
| 54745 |
+
2025-06-10 19:41:16:__main__:INFO: Greeting added for new user via handle_initial_greeting_load.
|
graph.png
ADDED
|
graph.py
CHANGED
|
@@ -6,6 +6,9 @@ import uuid
|
|
| 6 |
import aiohttp
|
| 7 |
import json
|
| 8 |
import httpx
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
from typing import Annotated
|
| 11 |
from typing import TypedDict, List, Optional, Literal
|
|
@@ -14,6 +17,8 @@ from typing_extensions import TypedDict
|
|
| 14 |
from pydantic import BaseModel, Field
|
| 15 |
from trafilatura import extract
|
| 16 |
|
|
|
|
|
|
|
| 17 |
from langchain_core.messages import AIMessage, HumanMessage, AnyMessage, ToolCall, SystemMessage, ToolMessage
|
| 18 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 19 |
from langchain_core.tools import tool
|
|
@@ -178,6 +183,11 @@ threed_object_gen_model = ChatOpenAI(
|
|
| 178 |
# other params...
|
| 179 |
)
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
model = weak_model
|
| 182 |
assistant_model = weak_model
|
| 183 |
|
|
@@ -764,6 +774,117 @@ ACCURATE PROMPT FOR MODEL GENERATING: [Your final single-paragraph prompt here]
|
|
| 764 |
print("Error: OPENAI_API_KEY environment variable not set.")
|
| 765 |
updates["messages"].append(AIMessage(content="OpenAI API key not configured. Cannot generate image."))
|
| 766 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 767 |
# 1. Call DALL-E API
|
| 768 |
dalle_api_url = "https://api.openai.com/v1/images/generations"
|
| 769 |
dalle_headers = {
|
|
|
|
| 6 |
import aiohttp
|
| 7 |
import json
|
| 8 |
import httpx
|
| 9 |
+
import io
|
| 10 |
+
import requests
|
| 11 |
+
from urllib.parse import quote
|
| 12 |
|
| 13 |
from typing import Annotated
|
| 14 |
from typing import TypedDict, List, Optional, Literal
|
|
|
|
| 17 |
from pydantic import BaseModel, Field
|
| 18 |
from trafilatura import extract
|
| 19 |
|
| 20 |
+
from huggingface_hub import InferenceClient
|
| 21 |
+
|
| 22 |
from langchain_core.messages import AIMessage, HumanMessage, AnyMessage, ToolCall, SystemMessage, ToolMessage
|
| 23 |
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 24 |
from langchain_core.tools import tool
|
|
|
|
| 183 |
# other params...
|
| 184 |
)
|
| 185 |
|
| 186 |
+
huggingfaceclient = InferenceClient(
|
| 187 |
+
provider="hf-inference",
|
| 188 |
+
api_key=os.environ["HF_TOKEN"],
|
| 189 |
+
)
|
| 190 |
+
|
| 191 |
model = weak_model
|
| 192 |
assistant_model = weak_model
|
| 193 |
|
|
|
|
| 774 |
print("Error: OPENAI_API_KEY environment variable not set.")
|
| 775 |
updates["messages"].append(AIMessage(content="OpenAI API key not configured. Cannot generate image."))
|
| 776 |
else:
|
| 777 |
+
|
| 778 |
+
# try:
|
| 779 |
+
# --- Your existing client setup ---
|
| 780 |
+
|
| 781 |
+
# prompt = dalle_prompt_text
|
| 782 |
+
# model_id = "black-forest-labs/FLUX.1-dev" # or any other model
|
| 783 |
+
|
| 784 |
+
# print(f"Generating image for prompt: '{prompt}' with model '{model_id}'...")
|
| 785 |
+
# # output is a PIL.Image object
|
| 786 |
+
# image = huggingfaceclient.text_to_image(
|
| 787 |
+
# prompt,
|
| 788 |
+
# model=model_id,
|
| 789 |
+
# )
|
| 790 |
+
# print("Image generated successfully.")
|
| 791 |
+
|
| 792 |
+
# # --- Code to save the image ---
|
| 793 |
+
|
| 794 |
+
# # 1. Define the directory name
|
| 795 |
+
# output_directory = "files"
|
| 796 |
+
|
| 797 |
+
# os.makedirs(output_directory, exist_ok=True)
|
| 798 |
+
# print(f"Ensured directory '{output_directory}' exists.")
|
| 799 |
+
|
| 800 |
+
# image_filename = "astronaut_horse.png"
|
| 801 |
+
|
| 802 |
+
# full_save_path = os.path.join(output_directory, image_filename)
|
| 803 |
+
|
| 804 |
+
# # 5. Save the PIL.Image object
|
| 805 |
+
# # The image object (if it's a PIL.Image) has a .save() method
|
| 806 |
+
# image.save(full_save_path)
|
| 807 |
+
|
| 808 |
+
# print(f"Image saved successfully to: {full_save_path}")
|
| 809 |
+
|
| 810 |
+
# if image:
|
| 811 |
+
# print("\nAttempting to upload generated image to Supabase...")
|
| 812 |
+
|
| 813 |
+
# # Define the filename for Supabase (can include a path prefix)
|
| 814 |
+
# supabase_target_filename = f"hf_generated_{uuid}" # Example: put in a 'hf_generated' folder
|
| 815 |
+
|
| 816 |
+
# # 1. Save the PIL image to a temporary in-memory buffer
|
| 817 |
+
# img_byte_arr = io.BytesIO()
|
| 818 |
+
# image.save(img_byte_arr, format='JPEG') # Match Dart's 'image/jpeg'
|
| 819 |
+
# img_byte_arr.seek(0) # Reset buffer's position to the beginning
|
| 820 |
+
|
| 821 |
+
# # Prepare the file for the multipart/form-data request
|
| 822 |
+
# # The field name 'file' and 'filename' should match what your Edge Function expects.
|
| 823 |
+
# files_payload = {
|
| 824 |
+
# 'file': (supabase_target_filename, img_byte_arr, 'image/jpeg')
|
| 825 |
+
# }
|
| 826 |
+
|
| 827 |
+
# # Headers (Content-Type for multipart/form-data is set automatically by requests
|
| 828 |
+
# # when using the `files` parameter, but you can set other headers if your edge function needs them)
|
| 829 |
+
# upload_headers = {
|
| 830 |
+
# # 'Authorization': 'Bearer YOUR_SUPABASE_ANON_KEY_OR_SERVICE_KEY_IF_EDGE_FUNCTION_NEEDS_IT'
|
| 831 |
+
# }
|
| 832 |
+
|
| 833 |
+
# print(f"Uploading image to Supabase Edge Function: as {supabase_target_filename}...")
|
| 834 |
+
# supabase_public_url = None
|
| 835 |
+
# try:
|
| 836 |
+
# upload_response = requests.post(
|
| 837 |
+
# 'https://yqewezudxihyadvmfovd.supabase.co/functions/v1/storage-upload',
|
| 838 |
+
# files=files_payload,
|
| 839 |
+
# headers=upload_headers
|
| 840 |
+
# )
|
| 841 |
+
# upload_response.raise_for_status() # Raise an HTTPError for bad responses (4XX or 5XX)
|
| 842 |
+
|
| 843 |
+
# # 2. Parse the response from the Edge Function
|
| 844 |
+
# # The Dart code expects: imgresponse.data['data']['path']
|
| 845 |
+
# response_json = upload_response.json()
|
| 846 |
+
# if 'data' in response_json and 'path' in response_json['data']:
|
| 847 |
+
# raw_path = response_json['data']['path']
|
| 848 |
+
# print(f"Edge function returned raw path: {raw_path}")
|
| 849 |
+
|
| 850 |
+
# # 3. Construct the public URL
|
| 851 |
+
# # The public URL format for Supabase Storage is:
|
| 852 |
+
# # SUPABASE_URL/storage/v1/object/public/BUCKET_NAME/FILE_PATH
|
| 853 |
+
# # The FILE_PATH needs to be URL encoded.
|
| 854 |
+
# encoded_path = quote(raw_path)
|
| 855 |
+
# # generated_image_url = f"{encoded_path}"'https://yqewezudxihyadvmfovd.supabase.co/storage/v1/object/public/product_images/$encodedPath';
|
| 856 |
+
# generated_image_url =f"https://yqewezudxihyadvmfovd.supabase.co/storage/v1/object/public/product_images/{encoded_path}"
|
| 857 |
+
|
| 858 |
+
# print(f"\nSuccessfully uploaded to Supabase!")
|
| 859 |
+
# print(f"Public URL: {generated_image_url}")
|
| 860 |
+
# else:
|
| 861 |
+
# print(f"Error: Unexpected response format from Edge Function: {response_json}")
|
| 862 |
+
# print("\nFailed to upload image to Supabase.")
|
| 863 |
+
|
| 864 |
+
# except requests.exceptions.RequestException as e_upload:
|
| 865 |
+
# print(f"Error uploading to Supabase: {e_upload}")
|
| 866 |
+
# if hasattr(e_upload, 'response') and e_upload.response is not None:
|
| 867 |
+
# print(f"Supabase Response status: {e_upload.response.status_code}")
|
| 868 |
+
# print(f"Supabase Response text: {e_upload.response.text}")
|
| 869 |
+
# print("\nFailed to upload image to Supabase.")
|
| 870 |
+
# except Exception as e_upload_generic:
|
| 871 |
+
# print(f"An unexpected error occurred during Supabase upload: {e_upload_generic}")
|
| 872 |
+
# print("\nFailed to upload image to Supabase.")
|
| 873 |
+
# else:
|
| 874 |
+
# print("No image was generated, skipping Supabase upload.")
|
| 875 |
+
|
| 876 |
+
# except KeyError:
|
| 877 |
+
# print("Error: The HF_TOKEN environment variable is not set.")
|
| 878 |
+
# print("Please set it before running the script. For example:")
|
| 879 |
+
# print(" export HF_TOKEN='your_hugging_face_api_token'")
|
| 880 |
+
# except ImportError:
|
| 881 |
+
# print("Error: The Pillow (PIL) library might not be installed correctly.")
|
| 882 |
+
# print("If 'image' is a PIL.Image object, Pillow is required to save it.")
|
| 883 |
+
# print("You might need to install it: pip install Pillow huggingface_hub")
|
| 884 |
+
# except Exception as e:
|
| 885 |
+
# print(f"An error occurred: {e}")
|
| 886 |
+
# print("Make sure your API token is valid, has the necessary permissions,")
|
| 887 |
+
# print(f"and the model '{model_id}' is accessible and compatible.")
|
| 888 |
# 1. Call DALL-E API
|
| 889 |
dalle_api_url = "https://api.openai.com/v1/images/generations"
|
| 890 |
dalle_headers = {
|