mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
feat(gemini): improve request context for support and compatibility
Include the Hermes client name and version with Gemini inference, model and tier checks, and TTS requests. Add focused coverage for the request headers and keep the Gemini-specific context scoped to Google Gemini endpoints.
This commit is contained in:
parent
c7e09f2571
commit
b8eb89f5c9
7 changed files with 126 additions and 3 deletions
|
|
@ -1850,11 +1850,24 @@ def _generate_gemini_tts(text: str, output_path: str, tts_config: Dict[str, Any]
|
|||
},
|
||||
}
|
||||
|
||||
try:
|
||||
import hermes_cli as _hermes_cli
|
||||
|
||||
_hermes_version = str(_hermes_cli.__version__)
|
||||
except Exception:
|
||||
_hermes_version = "0.0.0"
|
||||
|
||||
endpoint = f"{base_url}/models/{model}:generateContent"
|
||||
response = requests.post(
|
||||
endpoint,
|
||||
params={"key": api_key},
|
||||
headers={"Content-Type": "application/json"},
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
# Include Hermes client context following Gemini's partner
|
||||
# integration guidance:
|
||||
# https://ai.google.dev/gemini-api/docs/partner-integration
|
||||
"X-Goog-Api-Client": f"hermes-agent/{_hermes_version}",
|
||||
},
|
||||
json=payload,
|
||||
timeout=60,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue