Spaces:
Runtime error
Runtime error
| mport os | |
| import google.generativeai as genai | |
| # ===================================================== | |
| # CONFIGURATION CENTER | |
| # ===================================================== | |
| # --- 1. ZOHO CREDENTIALS (Reused from existing setup) --- | |
| # These credentials are used for the OAuth 2.0 flow to obtain an access token. | |
| # A tool (e.g., authenticate_zoho) will use these to ensure a valid token is available [7, 8]. | |
| CLIENT_ID = "1000.SIMKGAO5719K0TQ0QZQ31ZU57RLFNQ" | |
| CLIENT_SECRET = "60b329b4fe51930abee900cba6524ec7332cd67e06" | |
| REFRESH_TOKEN = "1000.fcbd3eb6544c48591ceb462eefe439e1.e6dacb8875fec5fa150596fa44eb9326" | |
| ORGANIZATION_ID = "60058860935" | |
| # --- 2. API ENDPOINTS (Updated for CRM) --- | |
| AUTH_URL = "https://accounts.zoho.in/oauth/v2/token" | |
| # CHANGE: Targeting Zoho CRM (not Books). Tools must POST to /crm/v2/{Module} [3, 6, 7]. | |
| API_BASE = "https://www.zohoapis.in/crm/v2" | |
| # CRM operations (like create_contact) will use this new base URL [6]. | |
| # --- 3. AI SETTINGS (New Gemini Integration) --- | |
| # REMOVE: MODEL_ID = "Qwen/Qwen2.5-1.5B-Instruct" | |
| # ADD: Gemini API Key as the agent will be driven by Gemini [2, 5, 9]. | |
| # The key 'AlzaSyB6Bw5Hr-FbiLK2hMm6cnSH193ZBpXTCE8' is derived from your provided API key details [10, 11]. | |
| GEMINI_API_KEY = "AlzaSyB6Bw5Hr-FbiLK2hMm6cnSH193ZBpXTCE8" | |
| os.environ['GOOGLE_API_KEY'] = GEMINI_API_KEY | |
| def configure_gemini(): | |
| """Initializes the Gemini client using the API key.""" | |
| # We use the google-generativeai library to call Gemini via API key [4, 12]. | |
| try: | |
| genai.configure(api_key=os.environ['GOOGLE_API_KEY']) | |
| print("Gemini API configured successfully.") | |
| except Exception as e: | |
| print(f"Error configuring Gemini API: {e}") | |