mirror of
https://github.com/trycua/lume.git
synced 2026-01-06 04:20:03 -06:00
add cua adapter support for gemini
This commit is contained in:
@@ -24,6 +24,10 @@ class CUAAdapter(CustomLLM):
|
||||
if "anthropic/" in model:
|
||||
model = f"anthropic/{self._normalize_model(model)}"
|
||||
api_base = api_base.removesuffix("/v1")
|
||||
elif "gemini/" in model or "google/" in model:
|
||||
# Route to Gemini pass-through endpoint
|
||||
model = f"gemini/{self._normalize_model(model)}"
|
||||
api_base = api_base.removesuffix("/v1") + "/gemini"
|
||||
else:
|
||||
model = f"openai/{self._normalize_model(model)}"
|
||||
|
||||
@@ -35,6 +39,10 @@ class CUAAdapter(CustomLLM):
|
||||
"stream": False,
|
||||
}
|
||||
|
||||
# Forward tools if provided
|
||||
if "tools" in kwargs:
|
||||
params["tools"] = kwargs["tools"]
|
||||
|
||||
if "optional_params" in kwargs:
|
||||
params.update(kwargs["optional_params"])
|
||||
del kwargs["optional_params"]
|
||||
@@ -71,6 +79,10 @@ class CUAAdapter(CustomLLM):
|
||||
if "anthropic/" in model:
|
||||
model = f"anthropic/{self._normalize_model(model)}"
|
||||
api_base = api_base.removesuffix("/v1")
|
||||
elif "gemini/" in model or "google/" in model:
|
||||
# Route to Gemini pass-through endpoint
|
||||
model = f"gemini/{self._normalize_model(model)}"
|
||||
api_base = api_base.removesuffix("/v1") + "/gemini"
|
||||
else:
|
||||
model = f"openai/{self._normalize_model(model)}"
|
||||
|
||||
@@ -82,6 +94,10 @@ class CUAAdapter(CustomLLM):
|
||||
"stream": False,
|
||||
}
|
||||
|
||||
# Forward tools if provided
|
||||
if "tools" in kwargs:
|
||||
params["tools"] = kwargs["tools"]
|
||||
|
||||
if "optional_params" in kwargs:
|
||||
params.update(kwargs["optional_params"])
|
||||
del kwargs["optional_params"]
|
||||
|
||||
Reference in New Issue
Block a user