- Refined entitlements to work with MiB for both embeddings and storage
- Improved DocumentVersion storage attributes to reflect Minio settings - Added size to DocumentVersions to easily calculate usage - License / LicenseTier forms and views added
This commit is contained in:
@@ -36,8 +36,14 @@ def ping():
|
||||
|
||||
@current_celery.task(name='create_embeddings', queue='embeddings')
|
||||
def create_embeddings(tenant_id, document_version_id):
|
||||
# Retrieve document version to process
|
||||
document_version = DocumentVersion.query.get(document_version_id)
|
||||
if document_version is None:
|
||||
raise Exception(f'Document version {document_version_id} not found')
|
||||
# BusinessEvent creates a context, which is why we need to use it with a with block
|
||||
with BusinessEvent('Create Embeddings', tenant_id, document_version_id=document_version_id):
|
||||
with BusinessEvent('Create Embeddings', tenant_id,
|
||||
document_version_id=document_version_id,
|
||||
document_version_file_size=document_version.file_size):
|
||||
current_app.logger.info(f'Creating embeddings for tenant {tenant_id} on document version {document_version_id}')
|
||||
try:
|
||||
# Retrieve Tenant for which we are processing
|
||||
@@ -52,11 +58,6 @@ def create_embeddings(tenant_id, document_version_id):
|
||||
model_variables = select_model_variables(tenant)
|
||||
current_app.logger.debug(f'Model variables: {model_variables}')
|
||||
|
||||
# Retrieve document version to process
|
||||
document_version = DocumentVersion.query.get(document_version_id)
|
||||
if document_version is None:
|
||||
raise Exception(f'Document version {document_version_id} not found')
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(f'Create Embeddings request received '
|
||||
f'for non existing document version {document_version_id} '
|
||||
|
||||
Reference in New Issue
Block a user