An interactive chat application demonstrating how to use Flyt for conversational AI with self-looping flows.
- Interactive command-line chat interface
- Maintains conversation history
- Uses OpenAI's GPT-3.5-turbo model
- Demonstrates self-looping flows in Flyt
- Go 1.21 or later
- OpenAI API key
- Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"- Install dependencies:
go mod tidygo run .Type your messages and press Enter. The AI will respond and maintain the conversation context.
Type exit to end the conversation.
The example demonstrates:
- Self-looping flow: The chat node connects to itself with a "continue" action
- State management: Conversation history is stored in SharedStore
- Conditional flow control: Returns "end" action to exit the loop
- Using closures: The API key is captured in the node's closure
main.go- Main application with the chat node implementationllm.go- OpenAI API integrationgo.mod- Module dependencies