INNER CODE UNIT · Python

get_groq_key

sunithvs/devb.io · config/settings.py:72

    def get_groq_key(cls):
        """
        Retrieve and rotate Groq API keys in a thread-safe manner.

        Returns:
            str: A Groq API key
        """
        with cls._lock:
            if not cls._GROQ_API_KEYS:
                raise ValueError("No Groq API keys configured")

            key = cls._GROQ_API_KEYS[cls._groq_key_index]
            cls._groq_key_index = (cls._groq_key_index + 1) % len(cls._GROQ_API_KEYS)
            return key

if __name__ == "__main__":
    Settings()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…