You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked the documentation and found no answer to my problem
I checked the existing issues and made sure there are no similar bug reports
Category
Bug (unexpected behavior)
Expected Behavior
No response
Observed Behavior
.venv\Lib\site-packages\ai_engine_sdk\client.py", line 205, in get_messages 'model': agent_json['context_json']['digest'], ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^KeyError: 'digest'
To Reproduce
I was testing the "Example Usage of the SDK" from docs
importasyncioimportloggingimportosimportsysfromtimeimportsleepfromai_engine_sdkimport (
AiEngine,
is_agent_message,
is_ai_engine_message,
is_confirmation_message,
is_stop_message,
is_task_selection_message, TaskSelectionMessage
)
fromai_engine_sdkimportApiBaseMessage, FunctionGrouplogger=logging.getLogger(__name__)
api_key=os.getenv("AV_API_KEY", "")
interaction_user_prompt_header=f"\n\n🤖 Interaction time"asyncdefmain():
logger.debug("🚀 Starting example execution")
ai_engine=AiEngine(api_key)
function_groups: list[FunctionGroup] =awaitai_engine.get_function_groups()
public_group=next((gforginfunction_groupsifg.name=="Fetch Verified"), None)
ifpublic_groupisNone:
raiseException('Could not find "Public" function group.')
session=awaitai_engine.create_session(function_group=public_group.uuid)
default_objective: str="Find a flight to warsaw."logger.info(interaction_user_prompt_header)
objective=input(f"\n🎯 What is your objective [default: {default_objective}]: ") ordefault_objectiveawaitsession.start(objective)
try:
empty_count=0session_ended=Falsewhileempty_count<100:
messages: list[ApiBaseMessage] =awaitsession.get_messages()
iflen(messages) ==0:
empty_count+=1else:
empty_count=0message: ApiBaseMessageformessageinmessages:
ifis_task_selection_message(message_type=message.type):
task_selection_message: TaskSelectionMessage=messagelogger.info(interaction_user_prompt_header)
print("Please select a key from the list below:\n")
for_, optionintask_selection_message.options.items():
print(f"➡ 🔑 {option.key} -> 🧰 {option.title}")
option_key=str(input("\nEnter task key: "))
# check the indexifoption_keynotintask_selection_message.options.keys():
raiseException(f"🔴 Invalid task number.\n You selected: {option_key}")
logger.debug(option_key)
awaitsession.submit_task_selection(
message,
[task_selection_message.options[option_key]]
)
deltask_selection_messageelifis_agent_message(message):
logger.info(interaction_user_prompt_header)
print(message.text.capitalize())
response=input("✍ (enter to skip): ")
ifresponse=="exit":
breakifresponse!="":
awaitsession.submit_response(message, response)
elifis_ai_engine_message(message):
logger.info(f"\n 🤖 ℹ Informative message \n\n ---> ✨{message.text}")
sleep(3.5)
elifis_confirmation_message(message_type=message.type):
logger.info(interaction_user_prompt_header)
print("Confirm:", message.payload)
response=input("\nPress enter to confirm, otherwise explain issue:\n")
ifresponse=="":
awaitsession.submit_confirmation(message)
else:
awaitsession.reject_confirmation(message, response)
elifis_stop_message(message):
logger.info("\n 👋 Session has ended, thanks! ")
session_ended=Truebreak# if the session has concluded then breakifsession_ended:
breaklogger.info(f"\n🤖 Processing\n")
sleep(1.5)
logger.debug(f"No messages: {empty_count} times in a row")
exceptExceptionase:
logger.debug(f"Unhandled exception: {e}")
print("Error", e)
raiseefinally:
# clean up the sessionawaitsession.delete()
if__name__=="__main__":
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
# level=logging.INFO,format='%(asctime)s %(levelname)s %(module)s: %(message)s',
datefmt="%H:%M:%S"
)
asyncio.run(main())
Prerequisites
Category
Bug (unexpected behavior)
Expected Behavior
No response
Observed Behavior
To Reproduce
I was testing the "Example Usage of the SDK" from docs
Version
0.1.2 (latest)
Environment Details (Optional)
Failure Logs (Optional)
No response
Additional Information (Optional)
The text was updated successfully, but these errors were encountered: