Default OpenAI transcription wrapper.
TranscriptionResponsesrc/mods/openai/utils/transcribe_audio_util.rs
Every place the codebase calls an AI model — what it does, what goes in and out, which call shape it uses, and the source file. Use it as a map for adding new call sites and as a pre-flight checklist for migrating off
aisdk onto
rig.
rig migration has to replace.| Concern | Today | Migration target |
|---|---|---|
| LLM SDK | aisdk::core::LanguageModelRequest via Openrouter::<DynamicModel> |
Replace builder + generate_text()/stream_text() with rig agent calls |
| Model resolution | crate::mods::ai::resolve_model(AiArea::*) → model id string |
Keep AiArea enum, swap resolver target |
| Structured output | schemars::JsonSchema on a private struct + generate_text() returning typed JSON |
Map to rig structured-output / extractor APIs |
| Tools | .with_tool(t) + step_count_is(N) stop condition |
Map to rig tool registration + agent loop |
| Streaming | .stream_text() + LanguageModelStreamChunkType |
Map to rig streaming agent |
| Usage logging | /add-ai-logging skill — required at every call site |
Preserve identical fields/args |
| Transcription | OpenAI REST via reqwest::multipart (not aisdk) |
Out of scope — leave as-is |
Each call site is tagged with one of these. Look for the colored dot.
reqwest. Used only for transcription.schemars::JsonSchema.step_count_is(N) stop.Where each call site sits in the larger flow. Each box is one AI op or a small group of related ops.
Raw OpenAI REST. Outside the aisdk → rig migration scope.
Default OpenAI transcription wrapper.
TranscriptionResponsesrc/mods/openai/utils/transcribe_audio_util.rs
Custom transcription request params.
TranscriptionRequest → TranscriptionResponsesrc/mods/openai/utils/transcribe_audio_with_options_util.rs
Speaker-labeled via gpt-4o-transcribe-diarize.
DiarizedTranscriptionResponsesrc/mods/openai/utils/transcribe_audio_diarized_util.rs
Map diarized labels to AI vs. caller.
HashMap<label, role>src/mods/openai/utils/identify_speakers_util.rs
Orchestrate download + transcription.
TwilioRecordingRequest → transcriptionsrc/mods/twilio/utils/process_twilio_recording_util.rs
Post-call pipeline. Runs after a recording is transcribed.
Run an analyzer's custom prompt on a transcription.
src/mods/analyzer/utils/analyze_call_text_util.rs
Pick org tags relevant to a call.
tag_ids[]src/mods/contact/services/auto_tag_contact_from_call_service.rs
Fill stub contact fields from transcription.
{first_name, last_name, company, …}src/mods/contact/services/enrich_contact_service.rs
Markdown summary for an interaction note.
src/mods/contact/services/notes/summarize_call_for_note_service.rs
Extract actionable tasks from a call.
tasks[{title,…}]src/mods/task/services/create_tasks_from_call_service.rs
Match post_call-trigger templates and spawn plans.
src/mods/plan/services/create_plans_from_call_service.rs
Message-pipeline counterparts to the call-pipeline enrichment ops.
Refresh memory note from new call/SMS context.
src/mods/contact/services/notes/update_contact_memory_service.rs
Extract memory + tasks from unprocessed SMS batch.
{memory_updates, tasks}src/mods/contact/services/ai/analyze_contact_messages_service.rs
Fill contact fields from SMS history.
src/mods/contact/services/ai/enrich_contact_from_messages_service.rs
Template matching, instantiation, and the agentic execution loop.
Match new_sms-trigger templates and instantiate.
src/mods/plan/services/create_plans_from_sms_service.rs
Generate contextual title/description for a contact.
{title, description}src/mods/plan/services/create_plan_from_template_service.rs
Agentic loop driving plan actions — custom plan tools, step_count_is(25), fallback model.
src/mods/plan/services/execute_plan_service.rs
Inbound SMS handlers — direct reply or suggestions for review.
One direct reply for an inbound message — query_knowledge, step_count_is(5).
src/mods/text_agent/services/generate_text_agent_single_reply_service.rs
Three reply candidates for human review.
TextAgentSuggestions{items[]}src/mods/text_agent/services/generate_text_agent_suggestions_service.rs
In-app agentic chat. The only streaming call site.
In-app agentic chat — full assistant tool suite, MAX_TOOL_STEPS.
src/mods/assistant/services/assistant_service.rs
Persist a short title for an assistant chat.
src/mods/assistant/services/generate_title_service.rs
KB query — used as a tool inside the text-agent and assistant loops.
Extract concise answer from KB documents.
src/mods/agent/services/handle_query_knowledge_tool_call_service.rs
Briefing cards and the daily org report.
Daily structured briefing card.
src/mods/dashboard/services/generate_dashboard_briefing_service.rs
Investigative briefing with tool calls — dashboard tools, step_count_is(10).
src/mods/dashboard/services/generate_detailed_briefing_service.rs
End-of-day org report.
src/mods/report/services/generate_daily_report_service.rs
All consume Session and run via Dioxus #[post] server functions. All return structured JSON via JsonSchema.
Instructions from a description.
AiBuilderGenerateRequest → AiBuilderResponsesrc/shared/ai_builder/api/generate_api.rs
Apply preset action to instructions.
AiBuilderEditRequest → AiBuilderResponsesrc/shared/ai_builder/api/edit_api.rs
Free-text edit of instructions.
AiBuilderCustomEditRequest → AiBuilderResponsesrc/shared/ai_builder/api/custom_edit_api.rs
All four text-agent fields.
TextAgentGenerateRequest → TextAgentAiResponsesrc/shared/ai_builder/api/text_agent_generate_api.rs
Preset action across four fields.
TextAgentEditRequest → TextAgentAiResponsesrc/shared/ai_builder/api/text_agent_edit_api.rs
Free-text edit across four fields.
TextAgentCustomEditRequest → TextAgentAiResponsesrc/shared/ai_builder/api/text_agent_custom_edit_api.rs
Plan template description + actions.
PlanTemplateGenerateRequest → PlanTemplateAiResponsesrc/shared/ai_builder/api/plan_template_generate_api.rs
Suggested order for the aisdk → rig swap. Smallest blast radius first.
JsonSchema → rig extractor mapping holds across shapes.src/mods/assistant/tools/** are tool definitions registered into the assistant loop — not separate AI call sites. Same for src/mods/ai/tools/** and the per-domain tool builders consumed by Execute plan and Detailed briefing.src/mods/widget/routes/widget_ws_route.rs (→ Generate single reply), src/mods/text_agent/api/suggestions_api.rs (→ Generate suggestions), src/mods/text_agent/services/handle_inbound_message_for_text_agent_service.rs (→ suggestions service)./add-ai-logging skill.