Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def standalone_question_prompt(chat_history: list[str], question: str) -> str:
).format(chat_history=chat_history_str, question=question)


def standalone_question(standalone_question_prompt: str, llm_client: openai.OpenAI, model: str) -> str:
def standalone_question(
standalone_question_prompt: str, llm_client: openai.OpenAI, model: str
) -> str:
"""Asks the LLM to create a standalone question from the prompt.

:param standalone_question_prompt: the prompt with context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
import openai

from hamilton import driver

from hamilton.contrib.dagworks import conversational_rag


# ──────────────────────────── Unit Tests ────────────────────────────


Expand Down
12 changes: 9 additions & 3 deletions contrib/hamilton/contrib/dagworks/faiss_rag/test_faiss_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@
# Import the module under test
from hamilton.contrib.dagworks import faiss_rag


# ──────────────────────────── Unit Tests ────────────────────────────


class TestRagPrompt:
"""Tests for the rag_prompt function (provider-independent)."""

def test_rag_prompt_includes_context(self):
result = faiss_rag.rag_prompt(context="Hamilton is a DAG framework", question="What is Hamilton?")
result = faiss_rag.rag_prompt(
context="Hamilton is a DAG framework", question="What is Hamilton?"
)
assert "Hamilton is a DAG framework" in result

def test_rag_prompt_includes_question(self):
Expand Down Expand Up @@ -250,7 +251,12 @@ def test_minimax_rag_response_real_api(self, minimax_api_key):
def test_minimax_driver_execution(self, minimax_api_key):
"""Test Hamilton driver execution with MiniMax config."""
with patch.dict(os.environ, {"MINIMAX_API_KEY": minimax_api_key}):
dr = driver.Builder().with_modules(faiss_rag).with_config({"provider": "minimax"}).build()
dr = (
driver.Builder()
.with_modules(faiss_rag)
.with_config({"provider": "minimax"})
.build()
)

client = faiss_rag.llm_client__minimax()
result = dr.execute(
Expand Down