Spaces:
Build error
Build error
Update app.py
Browse files68 unmodified lines6970717273747576777879808182838485868788899091929394959697729910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013173747568 unmodified lines executor_type="local", verbose=verbose ) print(f"Using OpenAIServerModel with X.AI API at {api_base}") elif model_type == "HfApiModel" and hf_token: # Use Hugging Face API self.gaia_agent = GAIAAgent( model_type="HfApiModel", model_id=model_id, api_key=hf_token, temperature=temperature, executor_type="local", verbose=verbose ) print(f"Using HfApiModel with model_id: {model_id}") elif openai_key: # Default to OpenAI API api_base = os.environ.get("AGENT_API_BASE") kwargs = { "model_type": "OpenAIServerModel", "model_id": model_id, "api_key": openai_key, "temperature": temperature, "executor_type": "local", "verbose": verbose } if api_base: kwargs["api_base"] = api_base print(f"Using custom API base: {api_base}") self.gaia_agent = GAIAAgent(**kwargs) print(f"Using OpenAIServerModel with model_id: {model_id}") else: # Fallback to using whatever token we have print("WARNING: Using fallback initialization with available token") if hf_token: self.gaia_agent = GAIAAgent( model_type="HfApiModel", model_id="mistralai/Mistral-7B-Instruct-v0.2", api_key=hf_token, temperature=temperature, executor_type="local", verbose=verbose ) elif openai_key: self.gaia_agent = GAIAAgent( model_type="OpenAIServerModel", model_id="gpt-3.5-turbo", api_key=openai_key, temperature=temperature, executor_type="local", verbose=verbose ) else: self.gaia_agent = GAIAAgent( model_type="OpenAIServerModel", model_id="grok-3-latest", api_key=xai_key, api_base=os.environ.get("XAI_API_BASE", "https://api.x.ai/v1"), temperature=temperature, executor_type="local", verbose=verbose ) except ImportError as ie: # Handle OpenAI module errors specifically if "openai" in str(ie).lower() and hf_token:app.py-59