-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/upload #609
Fix/upload #609
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
LOGAF Level 3 - /home/runner/work/quivr/quivr/backend/models/brains.py The code is generally good, but there are areas for potential improvement.
Example changes: class BrainDataAccess:
def __init__(self, commons):
self.commons = commons
def get_user_brains(self, user_id):
response = (
self.commons["supabase"]
.from_("brains_users")
.select("id:brain_id, brains (id: brain_id, name)")
.filter("user_id", "eq", user_id)
.execute()
)
return [item["brains"] for item in response.data]
# ... other methods ...
class Brain(BaseModel):
# ... properties ...
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.data_access = BrainDataAccess(self.commons)
def get_user_brains(self, user_id):
return self.data_access.get_user_brains(user_id)
# ... other methods ... LOGAF Level 3 - /home/runner/work/quivr/quivr/backend/routes/explore_routes.py The code is generally good, but there are areas for potential improvement.
Example changes: @explore_router.get("/explore/", dependencies=[Depends(AuthBearer())], tags=["Explore"])
async def explore_endpoint(
brain_id: UUID = Query(..., description="The ID of the brain"),
):
"""
Retrieve and explore unique user data vectors.
"""
try:
brain = Brain(id=brain_id)
unique_data = brain.get_unique_brain_files()
if not unique_data:
return {"message": "No unique data found for this brain."}
unique_data.sort(key=lambda x: int(x["size"]), reverse=True)
return {"documents": unique_data}
except Exception as e:
return {"error": str(e)} LOGAF Level 3 - /home/runner/work/quivr/quivr/backend/utils/vectors.py The code is generally good, but there are areas for potential improvement.
Example changes: class VectorDataAccess:
def __init__(self, commons):
self.commons = commons
def create_vector(self, doc, user_openai_api_key=None):
logger.info("Creating vector for document")
logger.info(f"Document: {doc}")
if user_openai_api_key:
self.commons["documents_vector_store"]._embedding = OpenAIEmbeddings(
openai_api_key=user_openai_api_key
) # pyright: ignore reportPrivateUsage=none
try:
sids = self.commons["documents_vector_store"].add_documents([doc])
if sids and len(sids) > 0:
return sids
except Exception as e:
logger.error(f"Error creating vector for document {e}")
return None
# ... other methods ...
class Neurons(BaseModel):
# ... properties ...
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.data_access = VectorDataAccess(self.commons)
def create_vector(self, doc, user_openai_api_key=None):
return self.data_access.create_vector(doc, user_openai_api_key)
# ... other methods ... 🗂️🔍🔧 Powered by Code Review GPT |
@@ -67,38 +67,39 @@ def error_callback(exception): | |||
print("An exception occurred:", exception) | |||
|
|||
|
|||
def process_batch(batch_ids): | |||
def process_batch(batch_ids: List[str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure about the return type ?
Thanks for typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep its a ulid now. We are handling them as strings I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it idempotent
scripts/tables.sql
Outdated
@@ -177,4 +175,4 @@ INSERT INTO migrations (name) | |||
SELECT '202307111517030_add_subscription_invitations_table' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modify last migration reference to yours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tables.sql to update
Agreed. We'll work on finding a way to automate this. |
* fix: document upload * feat: explore fix to use uuid id * chore: remove prints * fix: tables.sql
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Fixes: #607
Checklist before requesting a review
Please delete options that are not relevant.
Screenshots (if appropriate):