-
Notifications
You must be signed in to change notification settings - Fork 10
Collections: Add dynamic batching #718
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
base: main
Are you sure you want to change the base?
Changes from all commits
614801c
f8f9c2f
f9b3365
a074e36
1106abc
ff0726f
c7da9f0
8437442
f94998f
ed1ee38
5ec17be
3246e88
292be60
86e555c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| """add columns to collection job and documents table | ||
|
|
||
| Revision ID: 050 | ||
| Revises: 049 | ||
| Create Date: 2026-03-25 10:09:47.318575 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "050" | ||
| down_revision = "049" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| op.add_column( | ||
| "collection_jobs", | ||
| sa.Column( | ||
| "docs_num", | ||
| sa.Integer(), | ||
| nullable=True, | ||
| comment="Total number of documents to be processed in this job", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "collection_jobs", | ||
| sa.Column( | ||
| "total_size_mb", | ||
| sa.Float(), | ||
| nullable=True, | ||
| comment="Total size of documents being uploaded to collection", | ||
| ), | ||
| ) | ||
| op.add_column( | ||
| "document", | ||
| sa.Column( | ||
| "file_size_kb", | ||
| sa.Float(), | ||
| nullable=True, | ||
| comment="Size of the document in bytes", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be |
||
| ), | ||
| ) | ||
| op.add_column( | ||
| "collection_jobs", | ||
| sa.Column( | ||
| "documents", | ||
| sa.JSON(), | ||
| nullable=True, | ||
| comment="JSON array of document UUIDs included in this job", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.drop_column("document", "file_size_kb") | ||
| op.drop_column("collection_jobs", "total_size_mb") | ||
| op.drop_column("collection_jobs", "docs_num") | ||
| op.drop_column("collection_jobs", "documents") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| """add openai file id column | ||
|
|
||
| Revision ID: 051 | ||
| Revises: 050 | ||
| Create Date: 2026-03-31 14:27:26.391631 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| import sqlmodel.sql.sqltypes | ||
| from sqlalchemy.dialects import postgresql | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "051" | ||
| down_revision = "050" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| op.add_column( | ||
| "document", | ||
| sa.Column( | ||
| "openai_file_id", | ||
| sqlmodel.sql.sqltypes.AutoString(), | ||
| nullable=True, | ||
| comment="file id when uploaded to openai", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.drop_column("document", "openai_file_id") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| CollectionCrud, | ||
| CollectionJobCrud, | ||
| DocumentCollectionCrud, | ||
| DocumentCrud, | ||
| ) | ||
| from app.core.cloud import get_cloud_storage | ||
| from app.models import ( | ||
|
|
@@ -101,6 +102,8 @@ def create_collection( | |
| action_type=CollectionActionType.CREATE, | ||
| project_id=current_user.project_.id, | ||
| status=CollectionJobStatus.PENDING, | ||
| docs_num=len(request.documents), | ||
| documents=[str(doc_id) for doc_id in request.documents], | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ) | ||
| ) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.