Finding the most similar function available to get that done…
plan =await planner.create_plan_async(goal=ask)
print(f" The best single function to use is `{plan._skill_name}.{plan._function.name}`")
Date
ask ="What is today?"
print(f" Finding the most similar function available to get that done...")
plan =await planner.create_plan_async(goal=ask)
print(f" The best single function to use is `{plan._skill_name}.{plan._function.name}`")
Text
ask ="How do I write the word 'text' to a file?"
print(f" Finding the most similar function available to get that done...")plan =await planner.create_plan_async(goal=ask)print(f" The best single function to use is `{plan._skill_name}.{plan._function.name}`")
ask ="""Tomorrow is Valentine's day. I need to come up with a poem. Translate the poem to German."""
This will require two plugins (write poem and translate)
Call planner
plan =await planner.create_plan_async(goal=ask)
Obtain result
result =await plan.invoke_async()
Output
for index, step inenumerate(plan._steps):print(f"✅ Step {index+1} used function `{step._function.name}`")trace_resultp =Truedisplay( Markdown(f"## ✨ Generated result from the ask: {ask}\n\n---\n"+str(result)))
Display output
✅ Step 1 used function `ShortPoem`✅ Step 2 used function `Translate`✨ Generated result from the ask:Tomorrow is Valentine's day. I need to come up with a poem. Translate the poem to German.Rosen sind rot, Veilchen sind blau, Valentinstag ist da, was wirst du tun? Kaufe Schokolade und Blumen oder schreibe einen Liebesbrief, Vergiss nur nicht, es alles besser zu machen.Wenn du Single bist, keine Sorge, Gönn dir selbst, zu...
mmmhhh, maybe lost in translation 🙂
Take a closer look at the output
for index, step inenumerate(plan._steps):print(f"✅ Step {index+1} used function `{step._function.name}`")trace_resultp =Trueif trace_resultp:print("Longform trace:\n")for index, step inenumerate(plan._steps):print("Step:", index)print("Description:", step.description)print("Function:", step.skill_name +"."+ step._function.name)print("Output vars:", step._outputs)iflen(step._outputs) >0:print(" Output:\n", str.replace( result[step._outputs[0]], "\n", "\n "))display( Markdown(f"## ✨ Generated result from the ask: {ask}\n\n---\n"+str(result)))
Take a closer look at the output
✅ Step 1 used function `ShortPoem`✅ Step 2 used function `Translate`Longform trace:Step: 0Description: Turn a scenario into a short and entertaining poem.Function: LiterateFriend.ShortPoemOutput vars: ['POEM'] Output: Roses are red, violets are blue, Valentine's Day is here, what will you do? Buy chocolates and flowers, or write a love letter, Just don't forget, to make it all better. If you're single, don't you fret, Treat yourself, toStep: 1Description: Translate the input into a language of your choiceFunction: LiterateFriend.TranslateOutput vars: ['RESULT__TRANSLATED_POEM'] Output: Rosen sind rot, Veilchen sind blau, Valentinstag ist da, was wirst du tun? Kaufe Schokolade und Blumen oder schreibe einen Liebesbrief, Vergiss nur nicht, es alles besser zu machen. Wenn du Single bist, keine Sorge, Gönn dir selbst, zu...