Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 10
TTS/STT: Speech-To-Text Using Gemini in Unified API#550
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
5aad042f47c20c1e039614ac4de83c0bae77db94f1196eb5cdca3139271d6775ae59e5250ce9f1742a8bebb23940bcb697a6850a3f4693f6909e249a7b0062fa2519924007a2bbd2c7fb9074409f38f45f6348b5b3ea8ec26e0a6aa623efa5c86cf2c8f165a19a6ef79bf057b665102e325ff4d237dd97df920d2354a0fc37ac37f9b6a829321c41ce9d60e61943d3d3fb6ce6ee3dd60025364fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| """add_llm_call_table | ||
| Revision ID: 046 | ||
| Revises: 045 | ||
| Create Date: 2026-01-26 15:20:23.873332 | ||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| import sqlmodel.sql.sqltypes | ||
| from sqlalchemy.dialects import postgresql | ||
| # revision identifiers, used by Alembic. | ||
| revision = "046" | ||
| down_revision = "045" | ||
| branch_labels = None | ||
Prajna1999 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| depends_on = None | ||
| def upgrade(): | ||
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. 🧩 Analysis chain🏁 Script executed: find backend -name "043_add_llm_call_table.py" -type fRepository: ProjectTech4DevAI/kaapi-backend Length of output: 129 🏁 Script executed: if [ -f"backend/app/alembic/versions/043_add_llm_call_table.py" ];then
wc -l "backend/app/alembic/versions/043_add_llm_call_table.py"echo"---"
sed -n '15,25p'"backend/app/alembic/versions/043_add_llm_call_table.py"echo"---"
sed -n '167,177p'"backend/app/alembic/versions/043_add_llm_call_table.py"elseecho"File not found"fiRepository: ProjectTech4DevAI/kaapi-backend Length of output: 629 Add return type hints to Line 20 and line 172 define migration functions without return types. Add ✏️ Suggested typing update-def upgrade():+def upgrade() -> None:
@@
-def downgrade():+def downgrade() -> None:🤖 Prompt for AI Agents | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.create_table( | ||
| "llm_call", | ||
| sa.Column( | ||
| "id", | ||
| sa.Uuid(), | ||
| nullable=False, | ||
| comment="Unique identifier for the LLM call record", | ||
| ), | ||
| sa.Column( | ||
| "job_id", | ||
| sa.Uuid(), | ||
| nullable=False, | ||
| comment="Reference to the parent job (status tracked in job table)", | ||
| ), | ||
| sa.Column( | ||
| "project_id", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| comment="Reference to the project this LLM call belongs to", | ||
| ), | ||
| sa.Column( | ||
| "organization_id", | ||
| sa.Integer(), | ||
| nullable=False, | ||
| comment="Reference to the organization this LLM call belongs to", | ||
| ), | ||
| sa.Column( | ||
| "input", | ||
| sqlmodel.sql.sqltypes.AutoString(), | ||
| nullable=False, | ||
| comment="User input - text string, binary data, or file path for multimodal", | ||
| ), | ||
| sa.Column( | ||
| "input_type", | ||
| sa.String(), | ||
| nullable=False, | ||
| comment="Input type: text, audio, image", | ||
| ), | ||
| sa.Column( | ||
| "output_type", | ||
| sa.String(), | ||
| nullable=True, | ||
| comment="Expected output type: text, audio, image", | ||
| ), | ||
| sa.Column( | ||
| "provider", | ||
| sa.String(), | ||
| nullable=False, | ||
| comment="AI provider: openai, google, anthropic", | ||
| ), | ||
| sa.Column( | ||
| "model", | ||
| sqlmodel.sql.sqltypes.AutoString(), | ||
| nullable=False, | ||
| comment="Specific model used e.g. 'gpt-4o', 'gemini-2.5-pro'", | ||
| ), | ||
| sa.Column( | ||
| "provider_response_id", | ||
| sqlmodel.sql.sqltypes.AutoString(), | ||
| nullable=True, | ||
| comment="Original response ID from the provider (e.g., OpenAI's response ID)", | ||
| ), | ||
| sa.Column( | ||
| "content", | ||
| postgresql.JSONB(astext_type=sa.Text()), | ||
| nullable=True, | ||
| comment="Response content: {text: '...'}, {audio_bytes: '...'}, or {image: '...'}", | ||
| ), | ||
| sa.Column( | ||
| "usage", | ||
| postgresql.JSONB(astext_type=sa.Text()), | ||
| nullable=True, | ||
| comment="Token usage: {input_tokens, output_tokens, reasoning_tokens}", | ||
| ), | ||
| sa.Column( | ||
| "conversation_id", | ||
| sqlmodel.sql.sqltypes.AutoString(), | ||
| nullable=True, | ||
| comment="Identifier linking this response to its conversation thread", | ||
| ), | ||
| sa.Column( | ||
| "auto_create", | ||
| sa.Boolean(), | ||
| nullable=True, | ||
| comment="Whether to auto-create conversation if conversation_id doesn't exist (OpenAI specific)", | ||
| ), | ||
| sa.Column( | ||
| "config", | ||
| postgresql.JSONB(astext_type=sa.Text()), | ||
| nullable=True, | ||
| comment="Configuration: {config_id, config_version} for stored config OR {config_blob} for ad-hoc config", | ||
| ), | ||
| sa.Column( | ||
| "created_at", | ||
| sa.DateTime(), | ||
| nullable=False, | ||
| comment="Timestamp when the LLM call was created", | ||
| ), | ||
| sa.Column( | ||
| "updated_at", | ||
| sa.DateTime(), | ||
| nullable=False, | ||
| comment="Timestamp when the LLM call was last updated", | ||
| ), | ||
| sa.Column( | ||
| "deleted_at", | ||
| sa.DateTime(), | ||
| nullable=True, | ||
| comment="Timestamp when the record was soft-deleted", | ||
| ), | ||
| sa.ForeignKeyConstraint(["job_id"], ["job.id"], ondelete="CASCADE"), | ||
| sa.ForeignKeyConstraint( | ||
| ["organization_id"], ["organization.id"], ondelete="CASCADE" | ||
| ), | ||
| sa.ForeignKeyConstraint(["project_id"], ["project.id"], ondelete="CASCADE"), | ||
| sa.PrimaryKeyConstraint("id"), | ||
| ) | ||
| op.create_index( | ||
| "idx_llm_call_conversation_id", | ||
| "llm_call", | ||
| ["conversation_id"], | ||
| unique=False, | ||
| postgresql_where=sa.text("conversation_id IS NOT NULL AND deleted_at IS NULL"), | ||
| ) | ||
| op.create_index( | ||
| "idx_llm_call_job_id", | ||
| "llm_call", | ||
| ["job_id"], | ||
| unique=False, | ||
| postgresql_where=sa.text("deleted_at IS NULL"), | ||
| ) | ||
| op.alter_column( | ||
| "collection", | ||
| "llm_service_name", | ||
| existing_type=sa.VARCHAR(), | ||
| comment="Name of the LLM service", | ||
| existing_comment="Name of the LLM service provider", | ||
| existing_nullable=False, | ||
| ) | ||
Comment on lines
+20
to
+160
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. 🧩 Analysis chain🏁 Script executed: # Check the current state of the upgrade function in the migration file
head -30 backend/app/alembic/versions/042_add_llm_call_table.pyRepository: ProjectTech4DevAI/kaapi-backend Length of output: 718 🏁 Script executed: # Check other migration files to see if they have type hints
find backend/app/alembic/versions -name "*.py" -type f | head -5 | xargs -I {} sh -c 'echo "=== {} ===" && head -25 {}'Repository: ProjectTech4DevAI/kaapi-backend Length of output: 3370 🏁 Script executed: # Check if the file has a downgrade() function as well
grep -n "def downgrade" backend/app/alembic/versions/042_add_llm_call_table.pyRepository: ProjectTech4DevAI/kaapi-backend Length of output: 95 🏁 Script executed: # Check the downgrade function and surrounding context
sed -n '164,170p' backend/app/alembic/versions/042_add_llm_call_table.pyRepository: ProjectTech4DevAI/kaapi-backend Length of output: 316 Add return type hint to Line 20 defines ✏️ Suggested fix-def upgrade():+def upgrade() -> None:Per coding guidelines, all **/*.py files must include type hints for function parameters and return values. 🤖 Prompt for AI Agents | ||
| op.alter_column( | ||
| "llm_call", | ||
| "provider", | ||
| existing_type=sa.VARCHAR(), | ||
| comment="AI provider as sent by user (e.g openai, -native, google)", | ||
| existing_comment="AI provider: openai, google, anthropic", | ||
| existing_nullable=False, | ||
| ) | ||
| # ### end Alembic commands ### | ||
| def downgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.alter_column( | ||
| "collection", | ||
| "llm_service_name", | ||
| existing_type=sa.VARCHAR(), | ||
| comment="Name of the LLM service provider", | ||
| existing_comment="Name of the LLM service", | ||
| existing_nullable=False, | ||
| ) | ||
| op.alter_column( | ||
| "llm_call", | ||
| "provider", | ||
| existing_type=sa.VARCHAR(), | ||
| comment="AI provider: openai, google, anthropic", | ||
| existing_comment="AI provider as sent by user (e.g openai, -native, google)", | ||
| existing_nullable=False, | ||
| ) | ||
| op.drop_index( | ||
| "idx_llm_call_job_id", | ||
| table_name="llm_call", | ||
| postgresql_where=sa.text("deleted_at IS NULL"), | ||
| ) | ||
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. update this migration with updated name instead | ||
| op.drop_index( | ||
| "idx_llm_call_conversation_id", | ||
| table_name="llm_call", | ||
| postgresql_where=sa.text("conversation_id IS NOT NULL AND deleted_at IS NULL"), | ||
| ) | ||
| op.drop_table("llm_call") | ||
| # ### end Alembic commands ### | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -4,7 +4,7 @@ | ||||||||||||||||||||||||||||
| from app.api.deps import SessionDep, AuthContextDep | ||||||||||||||||||||||||||||
| from app.crud.config import ConfigCrud, ConfigVersionCrud | ||||||||||||||||||||||||||||
| from app.models import ( | ||||||||||||||||||||||||||||
| ConfigVersionCreate, | ||||||||||||||||||||||||||||
| ConfigVersionUpdate, | ||||||||||||||||||||||||||||
| ConfigVersionPublic, | ||||||||||||||||||||||||||||
| Message, | ||||||||||||||||||||||||||||
| ConfigVersionItems, | ||||||||||||||||||||||||||||
| @@ -24,13 +24,16 @@ | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
| def create_version( | ||||||||||||||||||||||||||||
| config_id: UUID, | ||||||||||||||||||||||||||||
| version_create: ConfigVersionCreate, | ||||||||||||||||||||||||||||
| version_create: ConfigVersionUpdate, | ||||||||||||||||||||||||||||
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. why we are replacing
| ||||||||||||||||||||||||||||
| current_user: AuthContextDep, | ||||||||||||||||||||||||||||
| session: SessionDep, | ||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||
Comment on lines
25
to
30
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. Add an explicit return type annotation. The endpoint is missing a return type, which is required by the Python typing guideline. 🔧 Suggested fix def create_version(
config_id: UUID,
version_create: ConfigVersionUpdatePartial,
current_user: AuthContextDep,
session: SessionDep,
-) :+) -> APIResponse[ConfigVersionPublic]:📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
| Create a new version for an existing configuration. | ||||||||||||||||||||||||||||
| The version number is automatically incremented. | ||||||||||||||||||||||||||||
| Only include the fields you want to update in config_blob. | ||||||||||||||||||||||||||||
| Provider, model, and params can be changed. | ||||||||||||||||||||||||||||
| Type is inherited from existing config and cannot be changed. | ||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||
| version_crud = ConfigVersionCrud( | ||||||||||||||||||||||||||||
| session=session, project_id=current_user.project_.id, config_id=config_id | ||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.