MCPcopy Create free account
hub / github.com/Roy3838/Observer / __init__

Method __init__

api/gemini_pro_handler.py:22–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

20 This handler uses paid tier models and prepaid credits.
21 """
22 def __init__(self):
23 super().__init__("gemini-pro")
24
25 # --- Model Mapping (like OpenRouter) ---
26 # Maps display names to actual Gemini model IDs
27 self.model_map = {
28 "gemma-3-27b-it": {
29 "model_id": "gemma-3-27b-it",
30 "parameters": "N/A",
31 "multimodal": True,
32 "pro": True
33 },
34 "gemini-2.5-flash-lite": {
35 "model_id": "gemini-2.5-flash-lite",
36 "parameters": "N/A",
37 "multimodal": True,
38 "pro": True
39 },
40 "gemini-2.5-flash-lite-free": {
41 "model_id": "gemini-2.5-flash-lite", # Maps to actual model
42 "parameters": "N/A",
43 "multimodal": True,
44 "pro": True
45 },
46 # "gemini-2.5-pro": {
47 # "model_id": "gemini-2.5-pro",
48 # "parameters": "N/A",
49 # "multimodal": True,
50 # "pro": True
51 # },
52 }
53
54 # Define supported models using the display names from the map
55 self.models = [
56 {
57 "name": display_name,
58 "parameters": model_info.get("parameters", "N/A"),
59 "multimodal": model_info.get("multimodal", False),
60 "pro": model_info.get("pro", False),
61 }
62 for display_name, model_info in self.model_map.items()
63 ]
64 self.api_key = os.environ.get("GEMINI_PRO_API_KEY")
65 if not self.api_key:
66 logger.error("GEMINI_PRO_API_KEY environment variable not set. Gemini Pro handler will fail.")
67 # Don't raise here, let handle_request fail clearly if called
68
69 logger.info("GeminiProAPIHandler registered models: %s", [m["name"] for m in self.models])
70
71 async def handle_request(self, request_data: dict):
72 """

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected