Skip to content

Commit d1a8dad

Browse files
committed
style: Format RAG files with ruff
1 parent 4cf3b92 commit d1a8dad

File tree

8 files changed

+14
-29
lines changed

8 files changed

+14
-29
lines changed

agents-core/vision_agents/core/rag/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
"RAGDocumentAddedEvent",
2020
"RAGFileAddedEvent",
2121
]
22-

agents-core/vision_agents/core/rag/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,3 @@ async def clear(self) -> None:
156156
Default implementation does nothing. Override if supported.
157157
"""
158158
pass
159-

agents-core/vision_agents/core/rag/events.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,3 @@ class RAGFileAddedEvent(BaseEvent):
5353
file_path: str = ""
5454
file_id: Optional[str] = None
5555
metadata: dict[str, Any] = field(default_factory=dict)
56-
57-
58-

agents-core/vision_agents/core/rag/types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,3 @@ def format_citation(self) -> str:
8686
return f"[doc:{self.document_id[:8]}]"
8787

8888
return "[unknown source]"
89-

examples/other_examples/gemini_rag_demo/gemini_rag_demo.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ async def on_file_added(event: RAGFileAddedEvent):
157157

158158
@rag.events.subscribe
159159
async def on_retrieval_complete(event: RAGRetrievalCompleteEvent):
160-
print(f" 🔎 Retrieved {event.result_count} results in {event.retrieval_time_ms:.0f}ms")
160+
print(
161+
f" 🔎 Retrieved {event.result_count} results in {event.retrieval_time_ms:.0f}ms"
162+
)
161163

162164
# Create and upload sample files
163165
print("\n📄 Creating sample documents...")
@@ -196,7 +198,9 @@ async def on_retrieval_complete(event: RAGRetrievalCompleteEvent):
196198
# The RAG provider automatically augments the query with relevant context
197199
response = await llm.simple_response(query)
198200

199-
print(f"💡 Answer: {response.text[:500]}{'...' if len(response.text) > 500 else ''}")
201+
print(
202+
f"💡 Answer: {response.text[:500]}{'...' if len(response.text) > 500 else ''}"
203+
)
200204

201205
# Cleanup
202206
print("\n" + "-" * 60)
@@ -215,4 +219,3 @@ async def on_retrieval_complete(event: RAGRetrievalCompleteEvent):
215219

216220
if __name__ == "__main__":
217221
asyncio.run(main())
218-

plugins/gemini/tests/test_gemini_rag.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ async def on_file_added(event: RAGFileAddedEvent):
117117
file_added_events.append(event)
118118

119119
# Create a test file
120-
with tempfile.NamedTemporaryFile(
121-
mode="w", suffix=".txt", delete=False
122-
) as f:
120+
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
123121
f.write(
124122
"Vision Agents is a framework for building AI agents that can "
125123
"process video and audio in real-time. It supports multiple LLM "
@@ -161,9 +159,7 @@ async def on_retrieval(event: RAGRetrievalCompleteEvent):
161159
retrieval_events.append(event)
162160

163161
# Create test files
164-
with tempfile.NamedTemporaryFile(
165-
mode="w", suffix=".txt", delete=False
166-
) as f:
162+
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
167163
f.write(
168164
"Password Reset Instructions:\n"
169165
"1. Go to the login page\n"
@@ -174,9 +170,7 @@ async def on_retrieval(event: RAGRetrievalCompleteEvent):
174170
)
175171
password_file = f.name
176172

177-
with tempfile.NamedTemporaryFile(
178-
mode="w", suffix=".txt", delete=False
179-
) as f:
173+
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
180174
f.write(
181175
"Account Settings:\n"
182176
"You can update your profile picture, display name, and "
@@ -251,9 +245,7 @@ async def test_llm_with_rag(self):
251245
llm = LLM(model="gemini-2.0-flash")
252246

253247
# Create a test file with specific information
254-
with tempfile.NamedTemporaryFile(
255-
mode="w", suffix=".txt", delete=False
256-
) as f:
248+
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
257249
f.write(
258250
"Company Policy Document\n\n"
259251
"Vacation Policy:\n"
@@ -295,9 +287,7 @@ async def test_get_file_search_tool(self):
295287
rag.get_file_search_tool()
296288

297289
# Create a test file
298-
with tempfile.NamedTemporaryFile(
299-
mode="w", suffix=".txt", delete=False
300-
) as f:
290+
with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
301291
f.write("Test content for file search tool.")
302292
temp_path = f.name
303293

@@ -360,4 +350,3 @@ async def test_build_context_prompt_no_citations(self):
360350

361351
assert "Test passage" in prompt
362352
assert "[unknown source]" not in prompt
363-

plugins/gemini/vision_agents/plugins/gemini/rag.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ async def add_file(self, file_path: str, metadata: Optional[dict] = None) -> str
226226
raise FileNotFoundError(f"File not found: {file_path}")
227227

228228
mime_type = self._get_mime_type(file_path)
229-
display_name = metadata.get("display_name", path.name) if metadata else path.name
229+
display_name = (
230+
metadata.get("display_name", path.name) if metadata else path.name
231+
)
230232

231233
# Build custom metadata if provided
232234
custom_metadata = None
@@ -408,4 +410,3 @@ def get_file_search_tool(self, top_k: Optional[int] = None) -> types.Tool:
408410
top_k=top_k or self._top_k,
409411
)
410412
)
411-

tests/test_rag.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for the core RAG module."""
22

3-
43
from vision_agents.core.rag import (
54
Chunk,
65
Document,
@@ -370,4 +369,3 @@ async def test_delete_document(self):
370369
# Try to delete again
371370
deleted_again = await provider.delete_document("test-doc")
372371
assert deleted_again is False
373-

0 commit comments

Comments
 (0)