data-prep-kit icon indicating copy to clipboard operation
data-prep-kit copied to clipboard

Problems in running Planning_DPK_agent.ipynb notebook

Open shahrokhDaijavad opened this issue 7 months ago • 2 comments

Search before asking

  • [x] I searched the issues and found no similar issues.

Component

Notebooks and Recipe

What happened + What you expected to happen

A few errors in running this notebook:

  1. First error in going to mermaid.ink
ValueError: Failed to reach https://mermaid.ink/ API while trying to render your graph after 1 retries. To resolve this issue:
1. Check your internet connection and try again
2. Try with higher retry settings: `draw_mermaid_png(..., max_retries=5, retry_delay=2.0)`
3. Use the Pyppeteer rendering method which will render your graph locally in a browser: `draw_mermaid_png(..., draw_method=MermaidDrawMethod.PYPPETEER)`

A solution has been found by replacing:

app = workflow.compile()
from IPython.display import Image, display
#display(Image(app.get_graph(xray=True).draw_mermaid_png()))
display(Image(app.get_graph().draw_mermaid_png()))

with the following:

import requests
from IPython.display import Image, display

app = workflow.compile()
mermaid_syntax = app.get_graph().draw_mermaid()
response = requests.post("https://kroki.io/mermaid/png", 
                        data=mermaid_syntax, 
                        headers={'Content-Type': 'text/plain'})

display(Image(response.content))

  1. Second error:

After the fix in 1), we now get an error in running the last cell,

# Run the graph
initial_state = {
    "task": task,
    "context": "",
    "plan": ["still no plan"],
    "planning_attempts": 0,
    "feedback": "Still no review",
    "needs_revision": "",
    "need_judge": True,
}

state = initial_state

for output in app.stream(state):
    pass

Here is the screenshot of the error:

Image

Reproduction script

Please see above.

Anything else

No response

OS

MacOS

Python

3.12

Are you willing to submit a PR?

  • [ ] Yes I am willing to submit a PR!

shahrokhDaijavad avatar May 14 '25 17:05 shahrokhDaijavad

@shahrokhDaijavad I tried the notebook and it worked with Replicate. Maybe missing or wrong Replicate key?

Mohammad-nassar10 avatar May 15 '25 12:05 Mohammad-nassar10

Thank you, @Mohammad-nassar10. Yes, the token in my .env had expired! I got a new token and it works now. Problem 2 above was due to an expired token, and no action is needed. For problem 1, please remember to submit a pull request (PR).

shahrokhDaijavad avatar May 15 '25 14:05 shahrokhDaijavad

Resolved;

swith005 avatar Jun 24 '25 18:06 swith005