feat(ai): introduce new env variables to configure provider instances#365
feat(ai): introduce new env variables to configure provider instances#365ondrej-langr wants to merge 3 commits into
Conversation
…oken and version for anthropic
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughProvider initialization refactored from direct ChangesAI Provider Environment Configuration
Sequence DiagramsequenceDiagram
participant Factory as Provider Factory (openai/anthropic)
participant ProcessEnv as process.env
participant Schema as Zod Schema
participant Client as OpenAI/Anthropic Client
Factory->>ProcessEnv: read environment
Factory->>Schema: parse(process.env)
Schema-->>Factory: validated {apiKey, baseURL, project, organization, authToken, version}
note over Factory: warn if API key missing
Factory->>Client: new Client({baseURL, project, organization, authToken, version})
Client-->>Factory: initialized instance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/trpc/src/agents/models.ts`:
- Line 4: Replace the default Zod import used in this file: change the existing
default import statement "import z from 'zod'" to the named import form "import
{ z } from 'zod'" so it matches the codebase convention and other modules that
reference the z symbol (e.g., usages of z.object, z.string, etc.).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5373cf03-d804-426e-804a-acd54990de67
📒 Files selected for processing (2)
apps/public/content/docs/self-hosting/environment-variables.mdxpackages/trpc/src/agents/models.ts
This adds support for custom OpenAI and Anthropic model providers like Azure which requires changing the base url of each request. Sometimes it is also necessary to define other properties which does this change as well. Makes anything configurable except headers.
Summary by CodeRabbit