Skip to content

examples: add multi-turn conversation with TEE verification#210

Open
ygd58 wants to merge 1 commit intoOpenGradient:mainfrom
ygd58:examples/multi-turn-conversation
Open

examples: add multi-turn conversation with TEE verification#210
ygd58 wants to merge 1 commit intoOpenGradient:mainfrom
ygd58:examples/multi-turn-conversation

Conversation

@ygd58
Copy link
Copy Markdown

@ygd58 ygd58 commented Mar 27, 2026

Summary

Adds examples/llm_multi_turn_conversation.py — a missing but commonly
needed usage pattern not covered by existing examples.

What it demonstrates

  • Maintaining conversation history across multiple turns
  • Context-aware follow-up questions (each turn references the previous)
  • Capturing the transaction hash from every inference step for on-chain verification
  • Clean helper functions (add_user_message, add_assistant_message) for history management

Why it's useful

The existing examples (llm_chat.py, llm_tool_calling.py) show single-turn
interactions. Real-world applications almost always require multi-turn
conversations. This fills that gap with a clear, runnable example.

Testing

Runs with:
export OG_PRIVATE_KEY="your_private_key"
python examples/llm_multi_turn_conversation.py

Shows how to maintain conversation history across turns while
getting a cryptographic transaction hash for every inference step.
Each turn builds on the previous context, demonstrating real-world
usage patterns for stateful LLM applications on OpenGradient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant