Provider-agnostic AI layer with AssemblyAI LLM Gateway support - #2113
Conversation
…essenger to the provider layer
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
hey @greptileai, please re-review the PR |
…the provider loop
|
hey @greptileai, please re-review the PR |
…ut cannot fail downstream
|
hey @greptileai, please re-review the PR |
What
All four LLM features (AI titles/summaries/chapters, transcript translation, docs Ask AI, and the support messenger) now go through one provider-agnostic layer built on the Vercel AI SDK (
apps/web/lib/ai/), replacing per-feature hand-rolled Groq/OpenAI/Anthropic clients.groq-sdkis removed.Self-hosters can now pick any provider via env:
AI_PROVIDER—assemblyai | openai | anthropic | groq | openai-compatibleAI_MODEL/AI_CHAT_MODEL/AI_STREAM_MODEL— per-role model overridesAI_BASE_URL/AI_API_KEY— any OpenAI-compatible endpoint (Ollama, OpenRouter, LM Studio…)assemblyairoutes through the AssemblyAI LLM Gateway using the existingASSEMBLY_API_KEY, so one key can cover transcription and AI features. It is never auto-detected — transcription-only instances don't start incurring LLM charges unless they opt in.Behavior at merge: unchanged
With
AI_PROVIDERunset (the default everywhere), providers are auto-detected per role to reproduce the current behavior exactly: generation prefers Groq → OpenAI → Anthropic (samegpt-oss-120b/gpt-4o-mini), chat features prefer Anthropic → OpenAI → Groq (sameclaude-sonnet-5). Later providers in each chain are automatic fallbacks — previously only summaries had any fallback at all.Design notes
generateText+ the existing JSON extraction (notgenerateObject): the AssemblyAI gateway rejectsresponse_formatongpt-ossmodels. The two map-reduce parse sites upgraded fromcleanJsonResponseto the more tolerantextractJsonObject, and the gateway path opts into server-sidejson-repair.supportsStreaming,supportsTemperature, token budgets) encode live-verified gateway rules: no streaming for non-OpenAI-family models, notemperaturefor Claude models,max_tokensmust always be explicit.stepCountIs(2), per-provider parallel-tool-call disable, an in-execute latch), and never retries another provider after an email was sent.text/plainstreaming contract; an empty completion (e.g. a thinking model consuming the whole token budget) now falls through to the next provider instead of streaming an empty answer."use step"boundaries.Verification
__tests__/e2e/ai-provider-live-e2e.test.ts, same pattern aslive-transcribe-local-e2e): real providers, real local MySQL/MinIO/media-server, no AI mocks — fresh recording → real AssemblyAI transcription → real title/summary; short + 24k-char map-reduce generation; docs-ask incremental streaming; live messenger reply. 6/6 under auto-detect and 6/6 underAI_PROVIDER=assemblyai, including a live rate-limit event absorbed by the fallback chain.Docs
self-hosting.mdxanddocker-compose.coolify.env.exampledocument all providers, the per-role auto-detect order, and the EU-gateway caveat.Greptile Summary
The PR centralizes AI generation, translation, docs Ask AI, and messenger behavior behind a provider-agnostic Vercel AI SDK layer with AssemblyAI gateway and OpenAI-compatible endpoint support.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(web): sanitize map-reduce keyPoints ..." | Re-trigger Greptile
Context used (3)