Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 26.1k
feat: Add GitLab Duo Agentic Chat Provider Support#7333
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
af0394b4d0787a183673f41f39ef0bc1beb0ee817c45bcab5fb83b1141fc6c30286d9dd02d907fd95cbdc5738818614ac6d3390bd1f4a75a9fbed07c4437fd1eaf3dfa8388cc2ac7848c20ff590b6165835d2aaeFile 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| import z from "zod" | ||
| import path from "path" | ||
| import os from "os" | ||
| import fuzzysort from "fuzzysort" | ||
| import { Config } from "../config/config" | ||
| import { mapValues, mergeDeep, omit, pickBy, sortBy } from "remeda" | ||
| @@ -35,6 +37,7 @@ import { createGateway } from "@ai-sdk/gateway" | ||
| import { createTogetherAI } from "@ai-sdk/togetherai" | ||
| import { createPerplexity } from "@ai-sdk/perplexity" | ||
| import { createVercel } from "@ai-sdk/vercel" | ||
| import { createGitLab } from "@gitlab/gitlab-ai-provider" | ||
| import { ProviderTransform } from "./transform" | ||
| export namespace Provider { | ||
| @@ -60,6 +63,7 @@ export namespace Provider { | ||
| "@ai-sdk/togetherai": createTogetherAI, | ||
| "@ai-sdk/perplexity": createPerplexity, | ||
| "@ai-sdk/vercel": createVercel, | ||
| "@gitlab/gitlab-ai-provider": createGitLab, | ||
| // @ts-ignore (TODO: kill this code so we dont have to maintain it) | ||
| "@ai-sdk/github-copilot": createGitHubCopilotOpenAICompatible, | ||
| } | ||
| @@ -390,6 +394,43 @@ export namespace Provider { | ||
| }, | ||
| } | ||
| }, | ||
| async gitlab(input) { | ||
| const instanceUrl = Env.get("GITLAB_INSTANCE_URL") || "https://gitlab.com" | ||
| const auth = await Auth.get(input.id) | ||
vglafirov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| const apiKey = await (async () => { | ||
| if (auth?.type === "oauth") return auth.access | ||
| if (auth?.type === "api") return auth.key | ||
| return Env.get("GITLAB_TOKEN") | ||
| })() | ||
| const config = await Config.get() | ||
| const providerConfig = config.provider?.["gitlab"] | ||
| return { | ||
| autoload: !!apiKey, | ||
| options: { | ||
| instanceUrl, | ||
| apiKey, | ||
| featureFlags: { | ||
| duo_agent_platform_agentic_chat: true, | ||
| duo_agent_platform: true, | ||
| ...(providerConfig?.options?.featureFlags || {}), | ||
| }, | ||
vglafirov marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }, | ||
| async getModel(sdk: ReturnType<typeof createGitLab>, modelID: string, options?: { anthropicModel?: string }) { | ||
| const anthropicModel = options?.anthropicModel | ||
| return sdk.agenticChat(modelID, { | ||
| anthropicModel, | ||
| featureFlags: { | ||
| duo_agent_platform_agentic_chat: true, | ||
| duo_agent_platform: true, | ||
| ...(providerConfig?.options?.featureFlags || {}), | ||
| }, | ||
| }) | ||
| }, | ||
| } | ||
| }, | ||
| "cloudflare-ai-gateway": async (input) => { | ||
| const accountId = Env.get("CLOUDFLARE_ACCOUNT_ID") | ||
| const gateway = Env.get("CLOUDFLARE_GATEWAY_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.