Update src/rag_pipeline.py
Browse files- 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 |
-
|
| 47 |
-
the ChatGoogleGenerativeAI interface for compatibility with app.py.
|
| 48 |
"""
|
| 49 |
def invoke(self, prompt: str):
|
| 50 |
-
response
|
|
|
|
| 51 |
model="models/gemini-2.5-flash",
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
)
|
| 54 |
-
#
|
| 55 |
class Result:
|
| 56 |
-
content = response.
|
| 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 |
|