Spaces:
Sleeping
Sleeping
Update prompts/prompts.py
Browse files- prompts/prompts.py +13 -0
prompts/prompts.py
CHANGED
|
@@ -39,13 +39,26 @@ def print_default_prompt_templates( agent ):
|
|
| 39 |
# Try to print from the in-memory PromptTemplates object
|
| 40 |
try:
|
| 41 |
print("Trying to print the in-memory PromptTemplates object")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
pt = getattr(agent, "prompt_templates", None)
|
| 43 |
if pt is not None:
|
| 44 |
def pick(obj, fields):
|
| 45 |
return {k: getattr(obj, k) for k in fields if getattr(obj, k, None)}
|
| 46 |
out = {}
|
|
|
|
|
|
|
| 47 |
if getattr(pt, "system_prompt", None):
|
| 48 |
out["system_prompt"] = pt.system_prompt
|
|
|
|
| 49 |
if getattr(pt, "planning", None):
|
| 50 |
out["planning"] = pick(pt.planning, ["plan", "update_plan_pre_messages", "update_plan_post_messages"])
|
| 51 |
if getattr(pt, "managed_agent", None):
|
|
|
|
| 39 |
# Try to print from the in-memory PromptTemplates object
|
| 40 |
try:
|
| 41 |
print("Trying to print the in-memory PromptTemplates object")
|
| 42 |
+
|
| 43 |
+
pt = agent.prompt_templates # <- this is the PromptTemplates object
|
| 44 |
+
|
| 45 |
+
# peek at pieces
|
| 46 |
+
print(pt.system_prompt)
|
| 47 |
+
print(pt.planning.plan)
|
| 48 |
+
print(pt.planning.update_plan_pre_messages)
|
| 49 |
+
print(pt.final_answer.pre_messages)
|
| 50 |
+
|
| 51 |
+
print("end of simple code")
|
| 52 |
pt = getattr(agent, "prompt_templates", None)
|
| 53 |
if pt is not None:
|
| 54 |
def pick(obj, fields):
|
| 55 |
return {k: getattr(obj, k) for k in fields if getattr(obj, k, None)}
|
| 56 |
out = {}
|
| 57 |
+
|
| 58 |
+
print ("starting filling out")
|
| 59 |
if getattr(pt, "system_prompt", None):
|
| 60 |
out["system_prompt"] = pt.system_prompt
|
| 61 |
+
print(pt.system_prompt)
|
| 62 |
if getattr(pt, "planning", None):
|
| 63 |
out["planning"] = pick(pt.planning, ["plan", "update_plan_pre_messages", "update_plan_post_messages"])
|
| 64 |
if getattr(pt, "managed_agent", None):
|