Skip to content

Commit 5fb7363

Browse files
committed
Fix additional linter errors
Signed-off-by: Jorge Garcia Oncins <jgarciao@redhat.com>
1 parent 7e6b3b6 commit 5fb7363

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

tests/rag/test_rag.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def test_rag_basic_inference(self, lls_client: LlamaStackClient) -> None:
5757
Validates that the server can perform text generation using the chat completions API
5858
and provides factually correct responses.
5959
60-
Based on the example available at https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
60+
Based on the example available at
61+
https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
6162
"""
6263
models = lls_client.models.list()
6364
model_id = next(m for m in models if m.api_model_type == "llm").identifier
@@ -84,7 +85,8 @@ def test_rag_simple_agent(self, lls_client: LlamaStackClient) -> None:
8485
Validates agent creation, session management, and turn-based interactions
8586
with both identity and capability questions.
8687
87-
Based on the example available at https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
88+
Based on the example available at
89+
https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
8890
"""
8991
models = lls_client.models.list()
9092
model_id = next(m for m in models if m.api_model_type == "llm").identifier
@@ -120,7 +122,8 @@ def test_rag_build_rag_agent(self, lls_client: LlamaStackClient) -> None:
120122
about fine-tuning techniques (LoRA, QAT, memory optimizations), and validates
121123
that responses contain expected technical keywords.
122124
123-
Based on the example available at https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
125+
Based on the example available at
126+
https://llama-stack.readthedocs.io/en/latest/getting_started/detailed_tutorial.html#step-4-run-the-demos
124127
"""
125128
models = lls_client.models.list()
126129
model_id = next(m for m in models if m.api_model_type == "llm").identifier
@@ -164,7 +167,7 @@ def test_rag_build_rag_agent(self, lls_client: LlamaStackClient) -> None:
164167
documents = [
165168
RAGDocument(
166169
document_id=f"num-{i}",
167-
content=f"https://raw.githubusercontent.com/pytorch/torchtune/refs/tags/v0.6.1/docs/source/tutorials/{url}",
170+
content=f"https://raw.githubusercontent.com/pytorch/torchtune/refs/tags/v0.6.1/docs/source/tutorials/{url}", # noqa
168171
mime_type="text/plain",
169172
metadata={},
170173
)

utilities/rag_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from contextlib import contextmanager
22
from ocp_resources.resource import NamespacedResource
33
from kubernetes.dynamic import DynamicClient
4-
from typing import Any, Dict, Generator, List, TypedDict
4+
from typing import Any, Dict, Generator, List, TypedDict, cast
55
from llama_stack_client import Agent, AgentEventLogger
66
from simple_logger.logger import get_logger
77

@@ -220,8 +220,8 @@ def validate_rag_agent_responses(
220220
"successful_turns": successful_turns,
221221
"failed_turns": total_turns - successful_turns,
222222
"success_rate": successful_turns / total_turns if total_turns > 0 else 0,
223-
"total_events": sum(result["event_count"] for result in all_results),
224-
"total_response_length": sum(result["response_length"] for result in all_results),
223+
"total_events": sum(cast(TurnResult, result)["event_count"] for result in all_results),
224+
"total_response_length": sum(cast(TurnResult, result)["response_length"] for result in all_results),
225225
}
226226

227227
overall_success = successful_turns == total_turns
@@ -235,4 +235,4 @@ def validate_rag_agent_responses(
235235
LOGGER.info(f"Success rate: {summary['success_rate']:.1%}")
236236
LOGGER.info(f"Overall result: {'✓ PASSED' if overall_success else '✗ FAILED'}")
237237

238-
return {"success": overall_success, "results": all_results, "summary": summary}
238+
return cast(ValidationResult, {"success": overall_success, "results": all_results, "summary": summary})

0 commit comments

Comments
 (0)