File size: 926 Bytes
658e790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os

import dotenv
import groq

# Load environment variables from .env file
dotenv.load_dotenv()

"""

Initialize Groq API client for large language model access.



This module sets up a connection to the Groq API service, which provides

access to fast large language models. The API key is securely retrieved

from environment variables rather than being hardcoded.



Environment Variables:

    GROQ_API_KEY: Personal API key for Groq service authentication



Raises:

    ValueError: If the GROQ_API_KEY environment variable is not set



Usage:

    Import this module to get access to a pre-configured Groq client

    that can be used for making API requests to Groq's language models.

"""

# Initialize Groq client securely
api_key = os.environ.get("GROQ_API_KEY")
if not api_key:
    raise ValueError("Please set the GROQ_API_KEY environment variable.")
client = groq.Client(api_key=api_key)