# CloudLLM Interactive Session Example This interactive example, implemented in Rust, demonstrates how to utilize the CloudLLM platform for having interactive conversations using OpenAI and its language model, GPT-4. ## What does this example do? This code sets up an interactive session between the user and an AI assistant powered by OpenAI. The conversation is fluid and ongoing, allowing the user to input their own prompts and receive responses in near-real time. The system as such operates on an infinite loop, prompting the user for their message time and again. Each time the user inputs a new message, the system responds with a response generated by GPT-4. The program makes use of the following components: - **OpenAIClient:** This module interacts with OpenAI and its GPT-4 model to generate responses to user queries. - **LLMSession:** This component manages the interaction session, sending user messages to OpenAI and receiving the responses. In addition, this example also includes an aesthetic function, i.e., printing loading dots while the system awaits a response from OpenAI. The user interface remains reactive and can take more input while it waits. ## How does it do it? 1. It instantiates the client with OpenAI credentials. 2. Initializes a new CloudLLM session with a system-defined prompt. 3. Enters an infinite loop of prompting the user for input, sending the message to the AI, and receiving and printing the response. 4. While waiting for the AI's response, a loading animation is displayed to the user. Requirement: You need to set the OPEN_AI_SECRET environment variable with your own OpenAI key for the program to work correctly. ## Usage To run the example, you require Rust and Tokio installed. It is run directly from the root of the repository, with the command "OPEN_AI_SECRET=your-key-here cargo run --example interactive_session" This is a great example of how a user can directly interact with an AI-powered assistant in an ongoing conversation, demonstrating the power of the natural language understanding capabilities offered by OpenAI's GPT-4 through the use of the CloudLLM platform.