# ๐Ÿ’ฌ Basic Chat: Mastering Simple LLM Conversations Welcome to the Basic Chat tutorial! This guide will help you understand how to have effective conversations with Large Language Models (LLMs) using CellMage. ## ๐ŸŽฏ What You'll Learn In this tutorial, you'll discover: - How to structure effective prompts - The basics of conversation flow - How to refine and improve LLM responses - Best practices for clear communication with LLMs ## ๐Ÿง™โ€โ™‚๏ธ Getting Started with Basic Chat Before diving in, make sure you have: - CellMage installed (`pip install cellmage`) - An API key configured (see the [Quickstart](quickstart.md) guide if needed) - The extension loaded in your notebook: ```ipython %load_ext cellmage ``` ## ๐Ÿ—ฃ๏ธ Step 1: Your First Conversation Let's start with a simple conversation: ```ipython %%llm Explain what makes a good prompt for an LLM. Keep it concise. ``` You'll notice the LLM responds with a concise explanation. But what if we want to follow up on this topic? ## ๐Ÿ”„ Step 2: Follow-Up Questions CellMage maintains conversation context automatically, allowing for natural follow-ups: ```ipython %%llm Can you give me 3 specific examples of what you just explained? ``` The model remembers the previous discussion about good prompts and provides examples based on that context. ## ๐Ÿงฉ Step 3: Structuring More Complex Prompts For more detailed responses, structure your prompt with clear sections: ```ipython %%llm I need information about Python's list comprehensions. Please structure your response as follows: 1. A simple definition 2. Basic syntax with an example 3. Three advanced examples with explanations 4. Common pitfalls to avoid ``` Notice how providing a structure helps the LLM organize its response in a more useful way. ## ๐Ÿ”ฎ Step 4: Different Response Styles You can request different styles or formats for responses: ```ipython %%llm Explain the concept of "technical debt" in software development. First, explain it as if I'm a senior developer. Then, explain the same concept as if I'm a non-technical project manager. ``` This approach is useful when you need explanations tailored to different audiences. ## ๐ŸŒก๏ธ Step 5: Adjusting Temperature The temperature parameter controls the creativity and randomness of responses: ```ipython # More deterministic, focused response %%llm --temperature 0.1 List 5 best practices for writing clean code. # More creative, varied response %%llm --temperature 0.8 List 5 best practices for writing clean code. ``` Compare the two responses. The lower temperature produces more predictable, conventional advice, while the higher temperature might introduce more unique or creative suggestions. ## โœ๏ธ Step 6: Refining Responses If a response isn't quite what you wanted, you can ask for refinements: ```ipython %%llm Your previous response about clean code was helpful, but could you focus more specifically on Python best practices and include examples for each? ``` This iterative refinement is one of the most powerful aspects of conversational LLMs. ## ๐ŸŽฎ Step 7: Controlling Response Length You can guide the LLM to produce shorter or longer responses: ```ipython %%llm Explain quantum computing in 2-3 sentences only. ``` Or for a more detailed explanation: ```ipython %%llm I'd like an in-depth explanation of quantum computing, including: - Key principles and concepts - How it differs from classical computing - Current limitations and challenges - Potential future applications Please be thorough and provide examples where helpful. ``` ## ๐Ÿ‘” Step 8: Setting the Tone You can request a specific tone for the response: ```ipython %%llm Write a brief explanation of blockchain technology with an enthusiastic tone. Now, explain the same concept with a more formal, academic tone. ``` ## ๐Ÿšซ Step 9: Handling Unhelpful Responses If you receive a response that isn't helpful, you can: ```ipython %%llm That explanation wasn't quite what I was looking for. Let me clarify: I'm trying to understand blockchain specifically in terms of its application for supply chain tracking. Can you focus on that aspect? ``` ## ๐Ÿง  Best Practices for Basic Chat 1. **Be Clear and Specific**: State exactly what you need 2. **Provide Context**: Give background information when needed 3. **Structure Complex Requests**: Use numbered lists or sections 4. **Iterate**: Refine your questions based on previous responses 5. **Experiment**: Try different prompts, temperatures, and approaches ## ๐Ÿ” Examining Your Chat History To review your conversation: ```ipython # Show your full conversation history %llm_config --show-history ``` ## ๐Ÿงน Starting Fresh When you want to start a new conversation without previous context: ```ipython # Clear conversation history %llm_config --clear-history ``` ## ๐ŸŽ“ What's Next? Now that you've mastered the basics of chatting with LLMs through CellMage, explore these tutorials: - [Advanced Prompting](advanced_prompting.md) - Learn sophisticated prompting techniques - [Working with Personas](working_with_personas.md) - Use and create different AI personalities - [Chain of Thought](chain_of_thought.md) - Guide the LLM through complex reasoning steps Happy chatting with your magical AI assistant! โœจ