mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 22:18:09 +01:00
32 lines
883 B
Python
32 lines
883 B
Python
import asyncio
|
|
|
|
from temporalio.client import Client
|
|
from workflows import EntityOllamaWorkflow
|
|
|
|
|
|
async def main():
|
|
# Create client connected to server at the given address
|
|
client = await Client.connect("localhost:7233")
|
|
workflow_id = "entity-ollama-workflow"
|
|
|
|
handle = client.get_workflow_handle(workflow_id)
|
|
|
|
# Queries the workflow for the conversation history
|
|
history = await handle.query(EntityOllamaWorkflow.get_conversation_history)
|
|
|
|
print("Conversation History")
|
|
print(
|
|
*(f"{speaker.title()}: {message}\n" for speaker, message in history), sep="\n"
|
|
)
|
|
|
|
# Queries the workflow for the conversation summary
|
|
summary = await handle.query(EntityOllamaWorkflow.get_summary_from_history)
|
|
|
|
if summary is not None:
|
|
print("Conversation Summary:")
|
|
print(summary)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|