ArabicNewsAnalyzer commited on
Commit
e27bd34
·
verified ·
1 Parent(s): be24846

Update app/memory/history_trimmer.py

Browse files
Files changed (1) hide show
  1. app/memory/history_trimmer.py +6 -6
app/memory/history_trimmer.py CHANGED
@@ -1,22 +1,22 @@
1
  from __future__ import annotations
2
 
3
  from langchain_core.messages import BaseMessage, RemoveMessage, SystemMessage
4
- from langchain_groq import ChatGroq
5
 
6
  from app.config import get_settings
7
 
8
  _summarizer_llm = None
9
 
10
 
11
- def _get_summarizer() -> ChatGroq:
12
  """Separate, cheaper model just for summarization — keeps main agent's
13
- token budget free and avoids competing for the same Groq quota."""
14
  global _summarizer_llm
15
  if _summarizer_llm is None:
16
  settings = get_settings()
17
- _summarizer_llm = ChatGroq(
18
- api_key=settings.groq_api_key,
19
- model="llama-3.1-8b-instant",
20
  temperature=0,
21
  )
22
  return _summarizer_llm
 
1
  from __future__ import annotations
2
 
3
  from langchain_core.messages import BaseMessage, RemoveMessage, SystemMessage
4
+ from langchain_nvidia_ai_endpoints import ChatNVIDIA
5
 
6
  from app.config import get_settings
7
 
8
  _summarizer_llm = None
9
 
10
 
11
+ def _get_summarizer() -> ChatNVIDIA:
12
  """Separate, cheaper model just for summarization — keeps main agent's
13
+ token budget free and avoids competing for the same NVIDIA rate limit."""
14
  global _summarizer_llm
15
  if _summarizer_llm is None:
16
  settings = get_settings()
17
+ _summarizer_llm = ChatNVIDIA(
18
+ api_key=settings.nvidia_api_key,
19
+ model="meta/llama-3.1-8b-instruct", # small/fast model for cheap summarization
20
  temperature=0,
21
  )
22
  return _summarizer_llm