--- title: Groq-LLaMA3.x emoji: 📚 colorFrom: yellow colorTo: blue sdk: streamlit sdk_version: 1.41.1 app_file: app.py pinned: false license: mit short_description: Groq & Llama3.x updated --- # Groq Chat with LLaMA3x A Streamlit-based chat application that leverages Groq's API to interact with LLaMA3x models. ## Features ### Model Integration - Seamless integration with Groq's LLaMA3x model family - Dynamic model selection from available LLaMA variants - Automatic model metadata fetching and display - Model-specific token limit handling ### Chat Interface - Real-time streaming responses with character-by-character display - Non-streaming mode for batch responses - Persistent chat history with session management - Clear chat functionality - User-friendly message input system - Distinct avatars for user (🧑‍💻) and assistant (🔋) messages ### Performance Controls - Adjustable token limit slider with model-specific maximums - Toggle between streaming and non-streaming modes - Automatic session state management - Error handling with user-friendly error messages ### Usage Analytics - Real-time token usage tracking - Prompt tokens - Response tokens - Total tokens used - Performance timing metrics - Prompt processing time - Response generation time - Total interaction time ### UI/UX Features - Responsive wide-layout design - Sidebar with model controls and settings - Groq branding integration - Important disclaimer for AI-generated content - Clear visual hierarchy with markdown formatting ## Prerequisites - Python 3.7+ - Groq API key - Required Python packages: - streamlit - groq - python-dotenv ## Installation 1. Clone the repository 2. Install dependencies: ```bash pip install streamlit groq python-dotenv ``` 3. Create a `.env` file and add your Groq API key: ``` GROQ_API_KEY=your_api_key_here ``` ## Usage Run the application: ```bash streamlit run app.py ``` The app will open in your default browser, featuring: - Model selection dropdown - Adjustable token limit slider - Streaming mode toggle - Clear chat functionality - Real-time usage statistics ## Security Note Always keep your API key secure and never commit it to version control. The application uses environment variables for sensitive data management. ## License MIT