Skip to content

Commit

Permalink
Ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
CollectiveUnicorn committed Aug 23, 2024
1 parent 2d6c566 commit 58e8193
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 10 additions & 12 deletions src/leapfrogai_api/backend/rag/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,18 @@ async def create_new_vector_store(
created_at=0, # Leave blank to have Postgres generate a timestamp
last_active_at=current_time,
file_counts=FileCounts(
cancelled=0,
completed=0,
failed=0,
in_progress=0,
total=0
cancelled=0, completed=0, failed=0, in_progress=0, total=0
),
usage_bytes=0,
metadata=request.metadata if hasattr(request, 'metadata') else None,
metadata=request.metadata if hasattr(request, "metadata") else None,
expires_after=expires_after,
expires_at=expires_at
expires_at=expires_at,
)

# Save the placeholder to the database
saved_placeholder = await crud_vector_store.create(object_=placeholder_vector_store)
saved_placeholder = await crud_vector_store.create(
object_=placeholder_vector_store
)

if saved_placeholder is None:
raise HTTPException(
Expand All @@ -195,9 +193,7 @@ async def create_new_vector_store(

# Add the actual creation task to background tasks
background_tasks.add_task(
self._complete_vector_store_creation,
saved_placeholder.id,
request
self._complete_vector_store_creation, saved_placeholder.id, request
)

return saved_placeholder
Expand All @@ -213,7 +209,9 @@ async def _complete_vector_store_creation(
):
"""Complete the vector store creation process in the background."""
crud_vector_store = CRUDVectorStore(db=self.db)
vector_store = await crud_vector_store.get(filters=FilterVectorStore(id=vector_store_id))
vector_store = await crud_vector_store.get(
filters=FilterVectorStore(id=vector_store_id)
)

if request.file_ids:
responses = await self.index_files(vector_store_id, request.file_ids)
Expand Down
6 changes: 4 additions & 2 deletions src/leapfrogai_api/routers/openai/vector_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ async def create_vector_store(

indexing_service = IndexingService(db=session)
try:
vector_store = await indexing_service.create_new_vector_store(request, background_tasks)
vector_store = await indexing_service.create_new_vector_store(
request, background_tasks
)
return vector_store
except Exception as exc:
traceback.print_exc()
Expand Down Expand Up @@ -202,4 +204,4 @@ async def delete_vector_store_file(
id=file_id,
object="vector_store.file.deleted",
deleted=deleted,
)
)

0 comments on commit 58e8193

Please sign in to comment.