mirror of https://github.com/Mai-with-u/MaiBot.git
尝试传入自定义base_url(实验性)
parent
0e0179fcd2
commit
74183ff079
|
|
@ -4,6 +4,7 @@ import base64
|
||||||
from typing import Callable, AsyncIterator, Optional, Coroutine, Any, List
|
from typing import Callable, AsyncIterator, Optional, Coroutine, Any, List
|
||||||
|
|
||||||
from google import genai
|
from google import genai
|
||||||
|
from google.genai import _base_url as genai_base_url
|
||||||
from google.genai.types import (
|
from google.genai.types import (
|
||||||
Content,
|
Content,
|
||||||
Part,
|
Part,
|
||||||
|
|
@ -349,6 +350,11 @@ class GeminiClient(BaseClient):
|
||||||
api_key=api_provider.api_key,
|
api_key=api_provider.api_key,
|
||||||
) # 这里和openai不一样,gemini会自己决定自己是否需要retry
|
) # 这里和openai不一样,gemini会自己决定自己是否需要retry
|
||||||
|
|
||||||
|
# 尝试传入自定义base_url(实验性,必须为Gemini格式)
|
||||||
|
if hasattr(api_provider, "base_url") and api_provider.base_url:
|
||||||
|
self.base_url = api_provider.base_url
|
||||||
|
self.client._api_client._base_url = self.base_url
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def clamp_thinking_budget(tb: int, model_id: str) -> int:
|
def clamp_thinking_budget(tb: int, model_id: str) -> int:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue