mirror of
https://github.com/usestrix/strix.git
synced 2026-08-28 05:25:00 +00:00
fix(llm): Pass API key and base URL to memory compressor litellm calls
The memory compressor was calling litellm.completion() without passing the api_key and api_base parameters, causing authentication errors when LLM_API_KEY is set but provider-specific env vars (OPENAI_API_KEY, etc.) are not. This matches the pattern used in dedupe.py.
This commit is contained in:
parent
c5bd30e677
commit
c2fbf81f1d
1 changed files with 13 additions and 1 deletions
|
|
@ -104,12 +104,24 @@ def _summarize_messages(
|
|||
conversation = "\n".join(formatted)
|
||||
prompt = SUMMARY_PROMPT_TEMPLATE.format(conversation=conversation)
|
||||
|
||||
api_key = Config.get("llm_api_key")
|
||||
api_base = (
|
||||
Config.get("llm_api_base")
|
||||
or Config.get("openai_api_base")
|
||||
or Config.get("litellm_base_url")
|
||||
or Config.get("ollama_api_base")
|
||||
)
|
||||
|
||||
try:
|
||||
completion_args = {
|
||||
completion_args: dict[str, Any] = {
|
||||
"model": model,
|
||||
"messages": [{"role": "user", "content": prompt}],
|
||||
"timeout": timeout,
|
||||
}
|
||||
if api_key:
|
||||
completion_args["api_key"] = api_key
|
||||
if api_base:
|
||||
completion_args["api_base"] = api_base
|
||||
|
||||
response = litellm.completion(**completion_args)
|
||||
summary = response.choices[0].message.content or ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue