MeteKaba commited on
Commit
3379d9a
·
verified ·
1 Parent(s): 4e83234

Update src/rag_pipeline.py

Browse files
Files changed (1) hide show
  1. src/rag_pipeline.py +8 -7
src/rag_pipeline.py CHANGED
@@ -43,20 +43,21 @@ class RAGState(TypedDict):
43
  # --- LLM Wrapper ---
44
  class GeminiLLMWrapper:
45
  """
46
- A simple wrapper around google-generativeai chat API to mimic
47
- the ChatGoogleGenerativeAI interface for compatibility with app.py.
48
  """
49
  def invoke(self, prompt: str):
50
- response = genai.chat.create(
 
51
  model="models/gemini-2.5-flash",
52
- messages=[{"role": "user", "content": prompt}]
 
 
53
  )
54
- # Wrap the response to have a .content attribute
55
  class Result:
56
- content = response.last
57
  return Result()
58
 
59
-
60
  def build_rag_pipeline():
61
  """Builds a LangGraph-based RAG pipeline compatible with LangChain 1.x."""
62
 
 
43
  # --- LLM Wrapper ---
44
  class GeminiLLMWrapper:
45
  """
46
+ Wrapper around Google Gemini API to mimic ChatGoogleGenerativeAI interface.
 
47
  """
48
  def invoke(self, prompt: str):
49
+ # Create a chat-style response using generate_text
50
+ response = genai.models.generate_text(
51
  model="models/gemini-2.5-flash",
52
+ prompt=prompt,
53
+ temperature=0.7,
54
+ max_output_tokens=512
55
  )
56
+ # The response text is under response.text
57
  class Result:
58
+ content = response.text
59
  return Result()
60
 
 
61
  def build_rag_pipeline():
62
  """Builds a LangGraph-based RAG pipeline compatible with LangChain 1.x."""
63