From f638860e900316c2cb92fd64ec55e43359b231ec Mon Sep 17 00:00:00 2001 From: Josako Date: Wed, 2 Oct 2024 14:12:16 +0200 Subject: [PATCH] - Improvements on audio processing to limit CPU and memory usage - Removed Portkey from the equation, and defined explicit monitoring using Langchain native code - Optimization of Business Event logging --- ..._adding_interaction_type_llm_embedding_.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 migrations/public/versions/254932fe7fe3_adding_interaction_type_llm_embedding_.py diff --git a/migrations/public/versions/254932fe7fe3_adding_interaction_type_llm_embedding_.py b/migrations/public/versions/254932fe7fe3_adding_interaction_type_llm_embedding_.py new file mode 100644 index 0000000..3f15b86 --- /dev/null +++ b/migrations/public/versions/254932fe7fe3_adding_interaction_type_llm_embedding_.py @@ -0,0 +1,68 @@ +"""Adding interaction type (LLM, Embedding, ASR) to Business Events + +Revision ID: 254932fe7fe3 +Revises: 16f70b210557 +Create Date: 2024-10-02 10:04:58.705839 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '254932fe7fe3' +down_revision = '16f70b210557' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('business_event_log', schema=None) as batch_op: + batch_op.add_column(sa.Column('llm_interaction_type', sa.String(length=20), nullable=True)) + + with op.batch_alter_table('roles_users', schema=None) as batch_op: + batch_op.drop_constraint('roles_users_user_id_fkey', type_='foreignkey') + batch_op.drop_constraint('roles_users_role_id_fkey', type_='foreignkey') + batch_op.create_foreign_key(None, 'user', ['user_id'], ['id'], referent_schema='public', ondelete='CASCADE') + batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'], referent_schema='public', ondelete='CASCADE') + + with op.batch_alter_table('tenant_domain', schema=None) as batch_op: + batch_op.drop_constraint('tenant_domain_created_by_fkey', type_='foreignkey') + batch_op.drop_constraint('tenant_domain_updated_by_fkey', type_='foreignkey') + batch_op.drop_constraint('tenant_domain_tenant_id_fkey', type_='foreignkey') + batch_op.create_foreign_key(None, 'user', ['created_by'], ['id'], referent_schema='public') + batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public') + batch_op.create_foreign_key(None, 'user', ['updated_by'], ['id'], referent_schema='public') + + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.drop_constraint('user_tenant_id_fkey', type_='foreignkey') + batch_op.create_foreign_key(None, 'tenant', ['tenant_id'], ['id'], referent_schema='public') + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.create_foreign_key('user_tenant_id_fkey', 'tenant', ['tenant_id'], ['id']) + + with op.batch_alter_table('tenant_domain', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.create_foreign_key('tenant_domain_tenant_id_fkey', 'tenant', ['tenant_id'], ['id']) + batch_op.create_foreign_key('tenant_domain_updated_by_fkey', 'user', ['updated_by'], ['id']) + batch_op.create_foreign_key('tenant_domain_created_by_fkey', 'user', ['created_by'], ['id']) + + with op.batch_alter_table('roles_users', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.drop_constraint(None, type_='foreignkey') + batch_op.create_foreign_key('roles_users_role_id_fkey', 'role', ['role_id'], ['id'], ondelete='CASCADE') + batch_op.create_foreign_key('roles_users_user_id_fkey', 'user', ['user_id'], ['id'], ondelete='CASCADE') + + with op.batch_alter_table('business_event_log', schema=None) as batch_op: + batch_op.drop_column('llm_interaction_type') + + # ### end Alembic commands ###