diff --git a/client/web/BUILD.bazel b/client/web/BUILD.bazel index 3548cd4cef1..19995d92753 100644 --- a/client/web/BUILD.bazel +++ b/client/web/BUILD.bazel @@ -1006,8 +1006,8 @@ ts_project( "src/enterprise/site-admin/cody/SiteAdminCodyPage.tsx", "src/enterprise/site-admin/cody/backend.ts", "src/enterprise/site-admin/dotcom/customers/SiteAdminCustomersPage.tsx", + "src/enterprise/site-admin/dotcom/productSubscriptions/CodyGatewayRateLimitModal.tsx", "src/enterprise/site-admin/dotcom/productSubscriptions/CodyServicesSection.tsx", - "src/enterprise/site-admin/dotcom/productSubscriptions/LlmProxyRateLimitModal.tsx", "src/enterprise/site-admin/dotcom/productSubscriptions/ModelBadges.tsx", "src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminCreateProductSubscriptionPage.tsx", "src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminGenerateProductLicenseForSubscriptionForm.tsx", diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/LlmProxyRateLimitModal.tsx b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyGatewayRateLimitModal.tsx similarity index 84% rename from client/web/src/enterprise/site-admin/dotcom/productSubscriptions/LlmProxyRateLimitModal.tsx rename to client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyGatewayRateLimitModal.tsx index 2a3e4afc5b8..f7cb5bb39fa 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/LlmProxyRateLimitModal.tsx +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyGatewayRateLimitModal.tsx @@ -6,32 +6,28 @@ import { Button, Modal, Input, H3, Text, ErrorAlert, Form } from '@sourcegraph/w import { LoaderButton } from '../../../../components/LoaderButton' import { - LLMProxyRateLimitFields, + CodyGatewayRateLimitFields, Scalars, - UpdateLLMProxyConfigResult, - UpdateLLMProxyConfigVariables, + UpdateCodyGatewayConfigResult, + UpdateCodyGatewayConfigVariables, } from '../../../../graphql-operations' -import { UPDATE_LLM_PROXY_CONFIG } from './backend' +import { UPDATE_CODY_GATEWAY_CONFIG } from './backend' import { ModelBadges } from './ModelBadges' import { prettyInterval } from './utils' -export interface LLMProxyRateLimitModalProps { +export interface CodyGatewayRateLimitModalProps { onCancel: () => void afterSave: () => void productSubscriptionID: Scalars['ID'] - current: LLMProxyRateLimitFields | null + current: CodyGatewayRateLimitFields | null mode: 'chat' | 'code' } -export const LLMProxyRateLimitModal: React.FunctionComponent> = ({ - onCancel, - afterSave, - productSubscriptionID, - current, - mode, -}) => { - const labelId = 'llmProxyRateLimit' +export const CodyGatewayRateLimitModal: React.FunctionComponent< + React.PropsWithChildren +> = ({ onCancel, afterSave, productSubscriptionID, current, mode }) => { + const labelId = 'codyGatewayRateLimit' const [limit, setLimit] = useState(current?.limit ?? 100) const onChangeLimit = useCallback>(event => { @@ -48,20 +44,20 @@ export const LLMProxyRateLimitModal: React.FunctionComponent(UPDATE_LLM_PROXY_CONFIG) + const [updateCodyGatewayConfig, { loading, error }] = useMutation< + UpdateCodyGatewayConfigResult, + UpdateCodyGatewayConfigVariables + >(UPDATE_CODY_GATEWAY_CONFIG) const onSubmit = useCallback( async event => { event.preventDefault() try { - await updateLLMProxyConfig({ + await updateCodyGatewayConfig({ variables: { productSubscriptionID, - llmProxyAccess: { + access: { chatCompletionsRateLimit: mode === 'chat' ? limit : undefined, chatCompletionsRateLimitIntervalSeconds: mode === 'chat' ? limitInterval : undefined, chatCompletionsAllowedModels: mode === 'chat' ? splitModels(allowedModels) : undefined, @@ -79,17 +75,17 @@ export const LLMProxyRateLimitModal: React.FunctionComponent

- Configure {mode === 'chat' ? 'chat request' : 'code completion request'} rate limit for LLM proxy + Configure {mode === 'chat' ? 'chat request' : 'code completion request'} rate limit for Cody Gateway

- LLM proxy is a Sourcegraph managed service that allows customer instances to talk to upstream LLMs under - our negotiated terms in a safe manner. + Cody Gateway is a Sourcegraph managed service that allows customer instances to talk to upstream LLMs + under our negotiated terms in a safe manner. {error && } diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyServicesSection.tsx b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyServicesSection.tsx index dd80a0b226a..0a32bfd3417 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyServicesSection.tsx +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/CodyServicesSection.tsx @@ -6,7 +6,7 @@ import { parseISO } from 'date-fns' import { Toggle } from '@sourcegraph/branded/src/components/Toggle' import { logger } from '@sourcegraph/common' import { useMutation, useQuery } from '@sourcegraph/http-client' -import { LLMProxyRateLimitSource } from '@sourcegraph/shared/src/graphql-operations' +import { CodyGatewayRateLimitSource } from '@sourcegraph/shared/src/graphql-operations' import { H3, ProductStatusBadge, @@ -27,19 +27,19 @@ import { import { CopyableText } from '../../../../components/CopyableText' import { - LLMProxyAccessFields, + CodyGatewayAccessFields, Scalars, - UpdateLLMProxyConfigResult, - UpdateLLMProxyConfigVariables, - LLMProxyRateLimitUsageDatapoint, - LLMProxyRateLimitFields, - DotComProductSubscriptionLLMUsageResult, - DotComProductSubscriptionLLMUsageVariables, + UpdateCodyGatewayConfigResult, + UpdateCodyGatewayConfigVariables, + CodyGatewayRateLimitUsageDatapoint, + CodyGatewayRateLimitFields, + DotComProductSubscriptionCodyGatewayUsageResult, + DotComProductSubscriptionCodyGatewayUsageVariables, } from '../../../../graphql-operations' import { ChartContainer } from '../../../../site-admin/analytics/components/ChartContainer' -import { DOTCOM_PRODUCT_SUBSCRIPTION_LLM_USAGE, UPDATE_LLM_PROXY_CONFIG } from './backend' -import { LLMProxyRateLimitModal } from './LlmProxyRateLimitModal' +import { DOTCOM_PRODUCT_SUBSCRIPTION_CODY_GATEWAY_USAGE, UPDATE_CODY_GATEWAY_CONFIG } from './backend' +import { CodyGatewayRateLimitModal } from './CodyGatewayRateLimitModal' import { ModelBadges } from './ModelBadges' import { prettyInterval } from './utils' @@ -52,7 +52,7 @@ interface Props { accessTokenError?: Error viewerCanAdminister: boolean refetchSubscription: () => Promise - llmProxyAccess: LLMProxyAccessFields + codyGatewayAccess: CodyGatewayAccessFields } export const CodyServicesSection: React.FunctionComponent = ({ @@ -62,18 +62,18 @@ export const CodyServicesSection: React.FunctionComponent = ({ currentSourcegraphAccessToken, accessTokenError, refetchSubscription, - llmProxyAccess, + codyGatewayAccess, }) => { - const [updateLLMProxyConfig, { loading: updateLLMProxyConfigLoading, error: updateLLMProxyConfigError }] = - useMutation(UPDATE_LLM_PROXY_CONFIG) + const [updateCodyGatewayConfig, { loading: updateCodyGatewayConfigLoading, error: updateCodyGatewayConfigError }] = + useMutation(UPDATE_CODY_GATEWAY_CONFIG) const onToggleCompletions = useCallback( async (value: boolean) => { try { - await updateLLMProxyConfig({ + await updateCodyGatewayConfig({ variables: { productSubscriptionID, - llmProxyAccess: { enabled: value }, + access: { enabled: value }, }, }) await refetchSubscription() @@ -81,7 +81,7 @@ export const CodyServicesSection: React.FunctionComponent = ({ logger.error(error) } }, - [productSubscriptionID, refetchSubscription, updateLLMProxyConfig] + [productSubscriptionID, refetchSubscription, updateCodyGatewayConfig] ) return ( @@ -91,7 +91,7 @@ export const CodyServicesSection: React.FunctionComponent = ({

Access token

- Access tokens can be used for LLM-proxy access + Access tokens can be used for Cody Gateway access {currentSourcegraphAccessToken && ( = ({

Completions

- {updateLLMProxyConfigError && } + {updateCodyGatewayConfigError && }
- {llmProxyAccess.enabled && ( + {codyGatewayAccess.enabled && ( <> @@ -144,7 +144,7 @@ export const CodyServicesSection: React.FunctionComponent = ({ = ({ = ({ ) } -export const LLMProxyRateLimitSourceBadge: React.FunctionComponent<{ - source: LLMProxyRateLimitSource +export const CodyGatewayRateLimitSourceBadge: React.FunctionComponent<{ + source: CodyGatewayRateLimitSource className?: string }> = ({ source, className }) => { switch (source) { - case LLMProxyRateLimitSource.OVERRIDE: + case CodyGatewayRateLimitSource.OVERRIDE: return ( @@ -182,7 +182,7 @@ export const LLMProxyRateLimitSourceBadge: React.FunctionComponent<{ ) - case LLMProxyRateLimitSource.PLAN: + case CodyGatewayRateLimitSource.PLAN: return ( @@ -193,8 +193,8 @@ export const LLMProxyRateLimitSourceBadge: React.FunctionComponent<{ } } -function generateSeries(data: LLMProxyRateLimitUsageDatapoint[]): LLMProxyRateLimitUsageDatapoint[][] { - const series: Record = {} +function generateSeries(data: CodyGatewayRateLimitUsageDatapoint[]): CodyGatewayRateLimitUsageDatapoint[][] { + const series: Record = {} for (const entry of data) { if (!series[entry.model]) { series[entry.model] = [] @@ -210,7 +210,7 @@ interface RateLimitRowProps { viewerCanAdminister: boolean refetchSubscription: () => Promise mode: 'chat' | 'code' - rateLimit: LLMProxyRateLimitFields | null + rateLimit: CodyGatewayRateLimitFields | null } const RateLimitRow: React.FunctionComponent = ({ @@ -223,15 +223,15 @@ const RateLimitRow: React.FunctionComponent = ({ }) => { const [showConfigModal, setShowConfigModal] = useState(false) - const [updateLLMProxyConfig, { loading: updateLLMProxyConfigLoading, error: updateLLMProxyConfigError }] = - useMutation(UPDATE_LLM_PROXY_CONFIG) + const [updateCodyGatewayConfig, { loading: updateCodyGatewayConfigLoading, error: updateCodyGatewayConfigError }] = + useMutation(UPDATE_CODY_GATEWAY_CONFIG) const onRemoveRateLimitOverride = useCallback(async () => { try { - await updateLLMProxyConfig({ + await updateCodyGatewayConfig({ variables: { productSubscriptionID, - llmProxyAccess: + access: mode === 'chat' ? { chatCompletionsRateLimit: 0, @@ -249,7 +249,7 @@ const RateLimitRow: React.FunctionComponent = ({ } catch (error) { logger.error(error) } - }, [productSubscriptionID, refetchSubscription, updateLLMProxyConfig, mode]) + }, [productSubscriptionID, refetchSubscription, updateCodyGatewayConfig, mode]) const afterSaveRateLimit = useCallback(async () => { try { @@ -269,7 +269,7 @@ const RateLimitRow: React.FunctionComponent = ({ {rateLimit !== null && ( <> )} )} {showConfigModal && ( - = ({ productSubscriptionUUID }) => { const { data, loading, error } = useQuery< - DotComProductSubscriptionLLMUsageResult, - DotComProductSubscriptionLLMUsageVariables - >(DOTCOM_PRODUCT_SUBSCRIPTION_LLM_USAGE, { variables: { uuid: productSubscriptionUUID } }) + DotComProductSubscriptionCodyGatewayUsageResult, + DotComProductSubscriptionCodyGatewayUsageVariables + >(DOTCOM_PRODUCT_SUBSCRIPTION_CODY_GATEWAY_USAGE, { variables: { uuid: productSubscriptionUUID } }) if (loading && !data) { return ( @@ -349,7 +349,7 @@ const RateLimitUsage: React.FunctionComponent = ({ productS ) } - const llmProxyAccess = data!.dotcom.productSubscription.llmProxyAccess + const { codyGatewayAccess } = data!.dotcom.productSubscription return ( <> @@ -360,8 +360,8 @@ const RateLimitUsage: React.FunctionComponent = ({ productS width={width} height={200} series={[ - ...generateSeries(llmProxyAccess.chatCompletionsRateLimit?.usage ?? []).map( - (data): Series => ({ + ...generateSeries(codyGatewayAccess.chatCompletionsRateLimit?.usage ?? []).map( + (data): Series => ({ data, getXValue(datum) { return parseISO(datum.date) @@ -370,12 +370,12 @@ const RateLimitUsage: React.FunctionComponent = ({ productS return datum.count }, id: 'chat-usage', - name: 'LLM Proxy chat completions usage', + name: 'Cody Gateway chat completions usage', color: 'var(--purple)', }) ), - ...generateSeries(llmProxyAccess.codeCompletionsRateLimit?.usage ?? []).map( - (data): Series => ({ + ...generateSeries(codyGatewayAccess.codeCompletionsRateLimit?.usage ?? []).map( + (data): Series => ({ data, getXValue(datum) { return parseISO(datum.date) @@ -384,7 +384,7 @@ const RateLimitUsage: React.FunctionComponent = ({ productS return datum.count }, id: 'code-completions-usage', - name: 'LLM Proxy code completions usage', + name: 'Cody Gateway code completions usage', color: 'var(--orange)', }) ), diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/ModelBadges.tsx b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/ModelBadges.tsx index 553e726fc0f..3615346a016 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/ModelBadges.tsx +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/ModelBadges.tsx @@ -16,7 +16,7 @@ function modelBadgeVariant(model: string): 'secondary' | 'danger' { switch (model) { // See here: https://console.anthropic.com/docs/api/reference // for currently available Anthropic models. Note that we also need to - // allow list the models on the LLM Proxy side. + // allow list the models on the Cody Gateway side. case 'claude-v1': case 'claude-v1.0': case 'claude-v1.2': @@ -25,7 +25,7 @@ function modelBadgeVariant(model: string): 'secondary' | 'danger' { case 'claude-instant-v1.0': // See here: https://platform.openai.com/docs/models/model-endpoint-compatibility // for currently available Anthropic models. Note that we also need to - // allow list the models on the LLM Proxy side. + // allow list the models on the Cody Gateway side. case 'gpt-4': case 'gpt-3.5-turbo': return 'secondary' diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx index 2d4a5261087..32bae6df717 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx @@ -178,7 +178,7 @@ export const SiteAdminProductSubscriptionPage: React.FunctionComponent NOTE: Self-hosted customers need to update to a minimum of version 5.0.4 to use completions. -> NOTE: Cody completions currently only work with Claude Instant or our LLMProxy configured with Claude Instant. Support for other models will be coming later. +
+ +> NOTE: Cody completions currently only work with Claude Instant or our Cody Gateway configured with Claude Instant. Support for other models will be coming later. diff --git a/enterprise/cmd/cody-gateway/internal/actor/actor.go b/enterprise/cmd/cody-gateway/internal/actor/actor.go index 0fa0c6fee47..d1af75fc56b 100644 --- a/enterprise/cmd/cody-gateway/internal/actor/actor.go +++ b/enterprise/cmd/cody-gateway/internal/actor/actor.go @@ -34,13 +34,13 @@ type Actor struct { // For example, for product subscriptions this is the subscription UUID. For // Sourcegraph.com users, this is the string representation of the user ID. ID string `json:"id"` - // AccessEnabled is an evaluated field that summarizes whether or not LLM-proxy access + // AccessEnabled is an evaluated field that summarizes whether or not Cody Gateway access // is enabled. // // For example, for product subscriptions it is based on whether the subscription is // archived, if access is enabled, and if any rate limits are set. AccessEnabled bool `json:"accessEnabled"` - // RateLimits holds the rate limits for LLM-proxy access for this actor. + // RateLimits holds the rate limits for Cody Gateway access for this actor. RateLimits map[types.CompletionsFeature]RateLimit `json:"rateLimits"` // LastUpdated indicates when this actor's state was last updated. LastUpdated *time.Time `json:"lastUpdated"` diff --git a/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription.go b/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription.go index 0fa42772acf..02fa1f59398 100644 --- a/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription.go +++ b/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription.go @@ -36,7 +36,7 @@ type Source struct { dotcom graphql.Client // internalMode, if true, indicates only dev and internal licenses may use - // this LLM-proxy instance. + // this Cody Gateway instance. internalMode bool } @@ -170,25 +170,25 @@ func NewActor(source *Source, token string, s dotcom.ProductSubscriptionState, i a := &actor.Actor{ Key: token, ID: s.Uuid, - AccessEnabled: !disallowedLicense && !s.IsArchived && s.LlmProxyAccess.Enabled, + AccessEnabled: !disallowedLicense && !s.IsArchived && s.CodyGatewayAccess.Enabled, RateLimits: map[types.CompletionsFeature]actor.RateLimit{}, LastUpdated: &now, Source: source, } - if s.LlmProxyAccess.ChatCompletionsRateLimit != nil { + if s.CodyGatewayAccess.ChatCompletionsRateLimit != nil { a.RateLimits[types.CompletionsFeatureChat] = actor.RateLimit{ - AllowedModels: s.LlmProxyAccess.ChatCompletionsRateLimit.AllowedModels, - Limit: s.LlmProxyAccess.ChatCompletionsRateLimit.Limit, - Interval: time.Duration(s.LlmProxyAccess.ChatCompletionsRateLimit.IntervalSeconds) * time.Second, + AllowedModels: s.CodyGatewayAccess.ChatCompletionsRateLimit.AllowedModels, + Limit: s.CodyGatewayAccess.ChatCompletionsRateLimit.Limit, + Interval: time.Duration(s.CodyGatewayAccess.ChatCompletionsRateLimit.IntervalSeconds) * time.Second, } } - if s.LlmProxyAccess.CodeCompletionsRateLimit != nil { + if s.CodyGatewayAccess.CodeCompletionsRateLimit != nil { a.RateLimits[types.CompletionsFeatureCode] = actor.RateLimit{ - AllowedModels: s.LlmProxyAccess.CodeCompletionsRateLimit.AllowedModels, - Limit: s.LlmProxyAccess.CodeCompletionsRateLimit.Limit, - Interval: time.Duration(s.LlmProxyAccess.CodeCompletionsRateLimit.IntervalSeconds) * time.Second, + AllowedModels: s.CodyGatewayAccess.CodeCompletionsRateLimit.AllowedModels, + Limit: s.CodyGatewayAccess.CodeCompletionsRateLimit.Limit, + Interval: time.Duration(s.CodyGatewayAccess.CodeCompletionsRateLimit.IntervalSeconds) * time.Second, } } diff --git a/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription_test.go b/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription_test.go index 98cecfaa8e0..5eade7c196e 100644 --- a/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription_test.go +++ b/enterprise/cmd/cody-gateway/internal/actor/productsubscription/productsubscription_test.go @@ -22,16 +22,16 @@ func TestNewActor(t *testing.T) { name: "not dev only", args: args{ dotcom.ProductSubscriptionState{ - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, @@ -48,16 +48,16 @@ func TestNewActor(t *testing.T) { name: "dev only, not a dev license", args: args{ dotcom.ProductSubscriptionState{ - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, @@ -74,16 +74,16 @@ func TestNewActor(t *testing.T) { name: "dev only, is a dev license", args: args{ dotcom.ProductSubscriptionState{ - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, diff --git a/enterprise/cmd/cody-gateway/internal/auth/auth.go b/enterprise/cmd/cody-gateway/internal/auth/auth.go index 61736e0e800..da625696060 100644 --- a/enterprise/cmd/cody-gateway/internal/auth/auth.go +++ b/enterprise/cmd/cody-gateway/internal/auth/auth.go @@ -51,7 +51,7 @@ func (a *Authenticator) Middleware(next http.Handler) http.Handler { logger, w, http.StatusForbidden, - errors.New("LLM proxy access not enabled"), + errors.New("Cody Gateway access not enabled"), ) err := a.EventLogger.LogEvent( diff --git a/enterprise/cmd/cody-gateway/internal/auth/auth_test.go b/enterprise/cmd/cody-gateway/internal/auth/auth_test.go index eb3b2ed3db8..1e1e13f0f09 100644 --- a/enterprise/cmd/cody-gateway/internal/auth/auth_test.go +++ b/enterprise/cmd/cody-gateway/internal/auth/auth_test.go @@ -58,16 +58,16 @@ func TestAuthenticatorMiddleware(t *testing.T) { Id: "UHJvZHVjdFN1YnNjcmlwdGlvbjoiNjQ1MmE4ZmMtZTY1MC00NWE3LWEwYTItMzU3Zjc3NmIzYjQ2Ig==", Uuid: "6452a8fc-e650-45a7-a0a2-357f776b3b46", IsArchived: false, - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, @@ -150,16 +150,16 @@ func TestAuthenticatorMiddleware(t *testing.T) { Id: "UHJvZHVjdFN1YnNjcmlwdGlvbjoiNjQ1MmE4ZmMtZTY1MC00NWE3LWEwYTItMzU3Zjc3NmIzYjQ2Ig==", Uuid: "6452a8fc-e650-45a7-a0a2-357f776b3b46", IsArchived: false, - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, @@ -199,16 +199,16 @@ func TestAuthenticatorMiddleware(t *testing.T) { Id: "UHJvZHVjdFN1YnNjcmlwdGlvbjoiNjQ1MmE4ZmMtZTY1MC00NWE3LWEwYTItMzU3Zjc3NmIzYjQ2Ig==", Uuid: "6452a8fc-e650-45a7-a0a2-357f776b3b46", IsArchived: false, - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, @@ -248,16 +248,16 @@ func TestAuthenticatorMiddleware(t *testing.T) { Id: "UHJvZHVjdFN1YnNjcmlwdGlvbjoiNjQ1MmE4ZmMtZTY1MC00NWE3LWEwYTItMzU3Zjc3NmIzYjQ2Ig==", Uuid: "6452a8fc-e650-45a7-a0a2-357f776b3b46", IsArchived: false, - LlmProxyAccess: dotcom.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess{ - LLMProxyAccessFields: dotcom.LLMProxyAccessFields{ + CodyGatewayAccess: dotcom.ProductSubscriptionStateCodyGatewayAccess{ + CodyGatewayAccessFields: dotcom.CodyGatewayAccessFields{ Enabled: true, - ChatCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit{ + ChatCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, }, }, - CodeCompletionsRateLimit: &dotcom.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit{ + CodeCompletionsRateLimit: &dotcom.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit{ RateLimitFields: dotcom.RateLimitFields{ Limit: 10, IntervalSeconds: 10, diff --git a/enterprise/cmd/cody-gateway/internal/dotcom/operations.go b/enterprise/cmd/cody-gateway/internal/dotcom/operations.go index 0fea4d8b3b6..d8d49b0b6f2 100644 --- a/enterprise/cmd/cody-gateway/internal/dotcom/operations.go +++ b/enterprise/cmd/cody-gateway/internal/dotcom/operations.go @@ -53,9 +53,9 @@ func (v *CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProduc return v.ProductSubscriptionState.IsArchived } -// GetLlmProxyAccess returns CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProductSubscription.LlmProxyAccess, and is useful for accessing the field via an interface. -func (v *CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProductSubscription) GetLlmProxyAccess() ProductSubscriptionStateLlmProxyAccessLLMProxyAccess { - return v.ProductSubscriptionState.LlmProxyAccess +// GetCodyGatewayAccess returns CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProductSubscription.CodyGatewayAccess, and is useful for accessing the field via an interface. +func (v *CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProductSubscription) GetCodyGatewayAccess() ProductSubscriptionStateCodyGatewayAccess { + return v.ProductSubscriptionState.CodyGatewayAccess } // GetActiveLicense returns CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProductSubscription.ActiveLicense, and is useful for accessing the field via an interface. @@ -95,7 +95,7 @@ type __premarshalCheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTok IsArchived bool `json:"isArchived"` - LlmProxyAccess ProductSubscriptionStateLlmProxyAccessLLMProxyAccess `json:"llmProxyAccess"` + CodyGatewayAccess ProductSubscriptionStateCodyGatewayAccess `json:"codyGatewayAccess"` ActiveLicense *ProductSubscriptionStateActiveLicenseProductLicense `json:"activeLicense"` } @@ -114,7 +114,7 @@ func (v *CheckAccessTokenDotcomDotcomQueryProductSubscriptionByAccessTokenProduc retval.Id = v.ProductSubscriptionState.Id retval.Uuid = v.ProductSubscriptionState.Uuid retval.IsArchived = v.ProductSubscriptionState.IsArchived - retval.LlmProxyAccess = v.ProductSubscriptionState.LlmProxyAccess + retval.CodyGatewayAccess = v.ProductSubscriptionState.CodyGatewayAccess retval.ActiveLicense = v.ProductSubscriptionState.ActiveLicense return &retval, nil } @@ -130,73 +130,73 @@ type CheckAccessTokenResponse struct { // GetDotcom returns CheckAccessTokenResponse.Dotcom, and is useful for accessing the field via an interface. func (v *CheckAccessTokenResponse) GetDotcom() CheckAccessTokenDotcomDotcomQuery { return v.Dotcom } -// LLMProxyAccessFields includes the GraphQL fields of LLMProxyAccess requested by the fragment LLMProxyAccessFields. +// CodyGatewayAccessFields includes the GraphQL fields of CodyGatewayAccess requested by the fragment CodyGatewayAccessFields. // The GraphQL type's documentation follows. // -// LLM-proxy access granted to a subscription. +// Cody Gateway access granted to a subscription. // FOR INTERNAL USE ONLY. -type LLMProxyAccessFields struct { - // Whether or not a subscription has LLM-proxy access. +type CodyGatewayAccessFields struct { + // Whether or not a subscription has Cody Gateway access. Enabled bool `json:"enabled"` // Rate limit for chat completions access, or null if not enabled. - ChatCompletionsRateLimit *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit `json:"chatCompletionsRateLimit"` + ChatCompletionsRateLimit *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit `json:"chatCompletionsRateLimit"` // Rate limit for code completions access, or null if not enabled. - CodeCompletionsRateLimit *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit `json:"codeCompletionsRateLimit"` + CodeCompletionsRateLimit *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit `json:"codeCompletionsRateLimit"` } -// GetEnabled returns LLMProxyAccessFields.Enabled, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFields) GetEnabled() bool { return v.Enabled } +// GetEnabled returns CodyGatewayAccessFields.Enabled, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFields) GetEnabled() bool { return v.Enabled } -// GetChatCompletionsRateLimit returns LLMProxyAccessFields.ChatCompletionsRateLimit, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFields) GetChatCompletionsRateLimit() *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit { +// GetChatCompletionsRateLimit returns CodyGatewayAccessFields.ChatCompletionsRateLimit, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFields) GetChatCompletionsRateLimit() *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit { return v.ChatCompletionsRateLimit } -// GetCodeCompletionsRateLimit returns LLMProxyAccessFields.CodeCompletionsRateLimit, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFields) GetCodeCompletionsRateLimit() *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit { +// GetCodeCompletionsRateLimit returns CodyGatewayAccessFields.CodeCompletionsRateLimit, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFields) GetCodeCompletionsRateLimit() *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit { return v.CodeCompletionsRateLimit } -// LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit includes the requested fields of the GraphQL type LLMProxyRateLimit. +// CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit includes the requested fields of the GraphQL type CodyGatewayRateLimit. // The GraphQL type's documentation follows. // -// LLM-proxy access rate limits for a subscription. +// Cody Gateway access rate limits for a subscription. // FOR INTERNAL USE ONLY. -type LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit struct { +type CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit struct { RateLimitFields `json:"-"` } -// GetAllowedModels returns LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit.AllowedModels, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) GetAllowedModels() []string { +// GetAllowedModels returns CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit.AllowedModels, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) GetAllowedModels() []string { return v.RateLimitFields.AllowedModels } -// GetSource returns LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit.Source, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) GetSource() LLMProxyRateLimitSource { +// GetSource returns CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit.Source, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) GetSource() CodyGatewayRateLimitSource { return v.RateLimitFields.Source } -// GetLimit returns LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit.Limit, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) GetLimit() int { +// GetLimit returns CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit.Limit, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) GetLimit() int { return v.RateLimitFields.Limit } -// GetIntervalSeconds returns LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit.IntervalSeconds, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) GetIntervalSeconds() int { +// GetIntervalSeconds returns CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit.IntervalSeconds, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) GetIntervalSeconds() int { return v.RateLimitFields.IntervalSeconds } -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) UnmarshalJSON(b []byte) error { +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) UnmarshalJSON(b []byte) error { if string(b) == "null" { return nil } var firstPass struct { - *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit + *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit graphql.NoUnmarshalJSON } - firstPass.LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit = v + firstPass.CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit = v err := json.Unmarshal(b, &firstPass) if err != nil { @@ -211,17 +211,17 @@ func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) Unmarsha return nil } -type __premarshalLLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit struct { +type __premarshalCodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit struct { AllowedModels []string `json:"allowedModels"` - Source LLMProxyRateLimitSource `json:"source"` + Source CodyGatewayRateLimitSource `json:"source"` Limit int `json:"limit"` IntervalSeconds int `json:"intervalSeconds"` } -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) MarshalJSON() ([]byte, error) { +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) MarshalJSON() ([]byte, error) { premarshaled, err := v.__premarshalJSON() if err != nil { return nil, err @@ -229,8 +229,8 @@ func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) MarshalJ return json.Marshal(premarshaled) } -func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) __premarshalJSON() (*__premarshalLLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit, error) { - var retval __premarshalLLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit +func (v *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit) __premarshalJSON() (*__premarshalCodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit, error) { + var retval __premarshalCodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit retval.AllowedModels = v.RateLimitFields.AllowedModels retval.Source = v.RateLimitFields.Source @@ -239,46 +239,46 @@ func (v *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit) __premar return &retval, nil } -// LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit includes the requested fields of the GraphQL type LLMProxyRateLimit. +// CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit includes the requested fields of the GraphQL type CodyGatewayRateLimit. // The GraphQL type's documentation follows. // -// LLM-proxy access rate limits for a subscription. +// Cody Gateway access rate limits for a subscription. // FOR INTERNAL USE ONLY. -type LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit struct { +type CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit struct { RateLimitFields `json:"-"` } -// GetAllowedModels returns LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit.AllowedModels, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) GetAllowedModels() []string { +// GetAllowedModels returns CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit.AllowedModels, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) GetAllowedModels() []string { return v.RateLimitFields.AllowedModels } -// GetSource returns LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit.Source, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) GetSource() LLMProxyRateLimitSource { +// GetSource returns CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit.Source, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) GetSource() CodyGatewayRateLimitSource { return v.RateLimitFields.Source } -// GetLimit returns LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit.Limit, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) GetLimit() int { +// GetLimit returns CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit.Limit, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) GetLimit() int { return v.RateLimitFields.Limit } -// GetIntervalSeconds returns LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit.IntervalSeconds, and is useful for accessing the field via an interface. -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) GetIntervalSeconds() int { +// GetIntervalSeconds returns CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit.IntervalSeconds, and is useful for accessing the field via an interface. +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) GetIntervalSeconds() int { return v.RateLimitFields.IntervalSeconds } -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) UnmarshalJSON(b []byte) error { +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) UnmarshalJSON(b []byte) error { if string(b) == "null" { return nil } var firstPass struct { - *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit + *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit graphql.NoUnmarshalJSON } - firstPass.LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit = v + firstPass.CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit = v err := json.Unmarshal(b, &firstPass) if err != nil { @@ -293,17 +293,17 @@ func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) Unmarsha return nil } -type __premarshalLLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit struct { +type __premarshalCodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit struct { AllowedModels []string `json:"allowedModels"` - Source LLMProxyRateLimitSource `json:"source"` + Source CodyGatewayRateLimitSource `json:"source"` Limit int `json:"limit"` IntervalSeconds int `json:"intervalSeconds"` } -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) MarshalJSON() ([]byte, error) { +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) MarshalJSON() ([]byte, error) { premarshaled, err := v.__premarshalJSON() if err != nil { return nil, err @@ -311,8 +311,8 @@ func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) MarshalJ return json.Marshal(premarshaled) } -func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) __premarshalJSON() (*__premarshalLLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit, error) { - var retval __premarshalLLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit +func (v *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit) __premarshalJSON() (*__premarshalCodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit, error) { + var retval __premarshalCodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit retval.AllowedModels = v.RateLimitFields.AllowedModels retval.Source = v.RateLimitFields.Source @@ -323,13 +323,13 @@ func (v *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit) __premar // The source of the rate limit returned. // FOR INTERNAL USE ONLY. -type LLMProxyRateLimitSource string +type CodyGatewayRateLimitSource string const ( // Indicates that a custom override for the rate limit has been stored. - LLMProxyRateLimitSourceOverride LLMProxyRateLimitSource = "OVERRIDE" + CodyGatewayRateLimitSourceOverride CodyGatewayRateLimitSource = "OVERRIDE" // Indicates that the rate limit is inferred by the subscriptions active plan. - LLMProxyRateLimitSourcePlan LLMProxyRateLimitSource = "PLAN" + CodyGatewayRateLimitSourcePlan CodyGatewayRateLimitSource = "PLAN" ) // ListProductSubscriptionFields includes the GraphQL fields of ProductSubscription requested by the fragment ListProductSubscriptionFields. @@ -360,9 +360,9 @@ func (v *ListProductSubscriptionFields) GetIsArchived() bool { return v.ProductSubscriptionState.IsArchived } -// GetLlmProxyAccess returns ListProductSubscriptionFields.LlmProxyAccess, and is useful for accessing the field via an interface. -func (v *ListProductSubscriptionFields) GetLlmProxyAccess() ProductSubscriptionStateLlmProxyAccessLLMProxyAccess { - return v.ProductSubscriptionState.LlmProxyAccess +// GetCodyGatewayAccess returns ListProductSubscriptionFields.CodyGatewayAccess, and is useful for accessing the field via an interface. +func (v *ListProductSubscriptionFields) GetCodyGatewayAccess() ProductSubscriptionStateCodyGatewayAccess { + return v.ProductSubscriptionState.CodyGatewayAccess } // GetActiveLicense returns ListProductSubscriptionFields.ActiveLicense, and is useful for accessing the field via an interface. @@ -404,7 +404,7 @@ type __premarshalListProductSubscriptionFields struct { IsArchived bool `json:"isArchived"` - LlmProxyAccess ProductSubscriptionStateLlmProxyAccessLLMProxyAccess `json:"llmProxyAccess"` + CodyGatewayAccess ProductSubscriptionStateCodyGatewayAccess `json:"codyGatewayAccess"` ActiveLicense *ProductSubscriptionStateActiveLicenseProductLicense `json:"activeLicense"` } @@ -424,7 +424,7 @@ func (v *ListProductSubscriptionFields) __premarshalJSON() (*__premarshalListPro retval.Id = v.ProductSubscriptionState.Id retval.Uuid = v.ProductSubscriptionState.Uuid retval.IsArchived = v.ProductSubscriptionState.IsArchived - retval.LlmProxyAccess = v.ProductSubscriptionState.LlmProxyAccess + retval.CodyGatewayAccess = v.ProductSubscriptionState.CodyGatewayAccess retval.ActiveLicense = v.ProductSubscriptionState.ActiveLicense return &retval, nil } @@ -504,9 +504,9 @@ func (v *ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSub return v.ListProductSubscriptionFields.ProductSubscriptionState.IsArchived } -// GetLlmProxyAccess returns ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSubscriptionConnectionNodesProductSubscription.LlmProxyAccess, and is useful for accessing the field via an interface. -func (v *ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSubscriptionConnectionNodesProductSubscription) GetLlmProxyAccess() ProductSubscriptionStateLlmProxyAccessLLMProxyAccess { - return v.ListProductSubscriptionFields.ProductSubscriptionState.LlmProxyAccess +// GetCodyGatewayAccess returns ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSubscriptionConnectionNodesProductSubscription.CodyGatewayAccess, and is useful for accessing the field via an interface. +func (v *ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSubscriptionConnectionNodesProductSubscription) GetCodyGatewayAccess() ProductSubscriptionStateCodyGatewayAccess { + return v.ListProductSubscriptionFields.ProductSubscriptionState.CodyGatewayAccess } // GetActiveLicense returns ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSubscriptionConnectionNodesProductSubscription.ActiveLicense, and is useful for accessing the field via an interface. @@ -548,7 +548,7 @@ type __premarshalListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsPr IsArchived bool `json:"isArchived"` - LlmProxyAccess ProductSubscriptionStateLlmProxyAccessLLMProxyAccess `json:"llmProxyAccess"` + CodyGatewayAccess ProductSubscriptionStateCodyGatewayAccess `json:"codyGatewayAccess"` ActiveLicense *ProductSubscriptionStateActiveLicenseProductLicense `json:"activeLicense"` } @@ -568,7 +568,7 @@ func (v *ListProductSubscriptionsDotcomDotcomQueryProductSubscriptionsProductSub retval.Id = v.ListProductSubscriptionFields.ProductSubscriptionState.Id retval.Uuid = v.ListProductSubscriptionFields.ProductSubscriptionState.Uuid retval.IsArchived = v.ListProductSubscriptionFields.ProductSubscriptionState.IsArchived - retval.LlmProxyAccess = v.ListProductSubscriptionFields.ProductSubscriptionState.LlmProxyAccess + retval.CodyGatewayAccess = v.ListProductSubscriptionFields.ProductSubscriptionState.CodyGatewayAccess retval.ActiveLicense = v.ListProductSubscriptionFields.ProductSubscriptionState.ActiveLicense return &retval, nil } @@ -620,8 +620,8 @@ type ProductSubscriptionState struct { Uuid string `json:"uuid"` // Whether this product subscription was archived. IsArchived bool `json:"isArchived"` - // LLM-proxy access granted to this subscription. Properties may be inferred from the active license, or be defined in overrides. - LlmProxyAccess ProductSubscriptionStateLlmProxyAccessLLMProxyAccess `json:"llmProxyAccess"` + // Cody Gateway access granted to this subscription. Properties may be inferred from the active license, or be defined in overrides. + CodyGatewayAccess ProductSubscriptionStateCodyGatewayAccess `json:"codyGatewayAccess"` // The currently active product license associated with this product subscription, if any. ActiveLicense *ProductSubscriptionStateActiveLicenseProductLicense `json:"activeLicense"` } @@ -635,9 +635,9 @@ func (v *ProductSubscriptionState) GetUuid() string { return v.Uuid } // GetIsArchived returns ProductSubscriptionState.IsArchived, and is useful for accessing the field via an interface. func (v *ProductSubscriptionState) GetIsArchived() bool { return v.IsArchived } -// GetLlmProxyAccess returns ProductSubscriptionState.LlmProxyAccess, and is useful for accessing the field via an interface. -func (v *ProductSubscriptionState) GetLlmProxyAccess() ProductSubscriptionStateLlmProxyAccessLLMProxyAccess { - return v.LlmProxyAccess +// GetCodyGatewayAccess returns ProductSubscriptionState.CodyGatewayAccess, and is useful for accessing the field via an interface. +func (v *ProductSubscriptionState) GetCodyGatewayAccess() ProductSubscriptionStateCodyGatewayAccess { + return v.CodyGatewayAccess } // GetActiveLicense returns ProductSubscriptionState.ActiveLicense, and is useful for accessing the field via an interface. @@ -672,41 +672,41 @@ type ProductSubscriptionStateActiveLicenseProductLicenseInfo struct { // GetTags returns ProductSubscriptionStateActiveLicenseProductLicenseInfo.Tags, and is useful for accessing the field via an interface. func (v *ProductSubscriptionStateActiveLicenseProductLicenseInfo) GetTags() []string { return v.Tags } -// ProductSubscriptionStateLlmProxyAccessLLMProxyAccess includes the requested fields of the GraphQL type LLMProxyAccess. +// ProductSubscriptionStateCodyGatewayAccess includes the requested fields of the GraphQL type CodyGatewayAccess. // The GraphQL type's documentation follows. // -// LLM-proxy access granted to a subscription. +// Cody Gateway access granted to a subscription. // FOR INTERNAL USE ONLY. -type ProductSubscriptionStateLlmProxyAccessLLMProxyAccess struct { - LLMProxyAccessFields `json:"-"` +type ProductSubscriptionStateCodyGatewayAccess struct { + CodyGatewayAccessFields `json:"-"` } -// GetEnabled returns ProductSubscriptionStateLlmProxyAccessLLMProxyAccess.Enabled, and is useful for accessing the field via an interface. -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) GetEnabled() bool { - return v.LLMProxyAccessFields.Enabled +// GetEnabled returns ProductSubscriptionStateCodyGatewayAccess.Enabled, and is useful for accessing the field via an interface. +func (v *ProductSubscriptionStateCodyGatewayAccess) GetEnabled() bool { + return v.CodyGatewayAccessFields.Enabled } -// GetChatCompletionsRateLimit returns ProductSubscriptionStateLlmProxyAccessLLMProxyAccess.ChatCompletionsRateLimit, and is useful for accessing the field via an interface. -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) GetChatCompletionsRateLimit() *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit { - return v.LLMProxyAccessFields.ChatCompletionsRateLimit +// GetChatCompletionsRateLimit returns ProductSubscriptionStateCodyGatewayAccess.ChatCompletionsRateLimit, and is useful for accessing the field via an interface. +func (v *ProductSubscriptionStateCodyGatewayAccess) GetChatCompletionsRateLimit() *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit { + return v.CodyGatewayAccessFields.ChatCompletionsRateLimit } -// GetCodeCompletionsRateLimit returns ProductSubscriptionStateLlmProxyAccessLLMProxyAccess.CodeCompletionsRateLimit, and is useful for accessing the field via an interface. -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) GetCodeCompletionsRateLimit() *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit { - return v.LLMProxyAccessFields.CodeCompletionsRateLimit +// GetCodeCompletionsRateLimit returns ProductSubscriptionStateCodyGatewayAccess.CodeCompletionsRateLimit, and is useful for accessing the field via an interface. +func (v *ProductSubscriptionStateCodyGatewayAccess) GetCodeCompletionsRateLimit() *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit { + return v.CodyGatewayAccessFields.CodeCompletionsRateLimit } -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) UnmarshalJSON(b []byte) error { +func (v *ProductSubscriptionStateCodyGatewayAccess) UnmarshalJSON(b []byte) error { if string(b) == "null" { return nil } var firstPass struct { - *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess + *ProductSubscriptionStateCodyGatewayAccess graphql.NoUnmarshalJSON } - firstPass.ProductSubscriptionStateLlmProxyAccessLLMProxyAccess = v + firstPass.ProductSubscriptionStateCodyGatewayAccess = v err := json.Unmarshal(b, &firstPass) if err != nil { @@ -714,22 +714,22 @@ func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) UnmarshalJSON(b [ } err = json.Unmarshal( - b, &v.LLMProxyAccessFields) + b, &v.CodyGatewayAccessFields) if err != nil { return err } return nil } -type __premarshalProductSubscriptionStateLlmProxyAccessLLMProxyAccess struct { +type __premarshalProductSubscriptionStateCodyGatewayAccess struct { Enabled bool `json:"enabled"` - ChatCompletionsRateLimit *LLMProxyAccessFieldsChatCompletionsRateLimitLLMProxyRateLimit `json:"chatCompletionsRateLimit"` + ChatCompletionsRateLimit *CodyGatewayAccessFieldsChatCompletionsRateLimitCodyGatewayRateLimit `json:"chatCompletionsRateLimit"` - CodeCompletionsRateLimit *LLMProxyAccessFieldsCodeCompletionsRateLimitLLMProxyRateLimit `json:"codeCompletionsRateLimit"` + CodeCompletionsRateLimit *CodyGatewayAccessFieldsCodeCompletionsRateLimitCodyGatewayRateLimit `json:"codeCompletionsRateLimit"` } -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) MarshalJSON() ([]byte, error) { +func (v *ProductSubscriptionStateCodyGatewayAccess) MarshalJSON() ([]byte, error) { premarshaled, err := v.__premarshalJSON() if err != nil { return nil, err @@ -737,19 +737,19 @@ func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) MarshalJSON() ([] return json.Marshal(premarshaled) } -func (v *ProductSubscriptionStateLlmProxyAccessLLMProxyAccess) __premarshalJSON() (*__premarshalProductSubscriptionStateLlmProxyAccessLLMProxyAccess, error) { - var retval __premarshalProductSubscriptionStateLlmProxyAccessLLMProxyAccess +func (v *ProductSubscriptionStateCodyGatewayAccess) __premarshalJSON() (*__premarshalProductSubscriptionStateCodyGatewayAccess, error) { + var retval __premarshalProductSubscriptionStateCodyGatewayAccess - retval.Enabled = v.LLMProxyAccessFields.Enabled - retval.ChatCompletionsRateLimit = v.LLMProxyAccessFields.ChatCompletionsRateLimit - retval.CodeCompletionsRateLimit = v.LLMProxyAccessFields.CodeCompletionsRateLimit + retval.Enabled = v.CodyGatewayAccessFields.Enabled + retval.ChatCompletionsRateLimit = v.CodyGatewayAccessFields.ChatCompletionsRateLimit + retval.CodeCompletionsRateLimit = v.CodyGatewayAccessFields.CodeCompletionsRateLimit return &retval, nil } -// RateLimitFields includes the GraphQL fields of LLMProxyRateLimit requested by the fragment RateLimitFields. +// RateLimitFields includes the GraphQL fields of CodyGatewayRateLimit requested by the fragment RateLimitFields. // The GraphQL type's documentation follows. // -// LLM-proxy access rate limits for a subscription. +// Cody Gateway access rate limits for a subscription. // FOR INTERNAL USE ONLY. type RateLimitFields struct { // The models that are allowed for this rate limit bucket. @@ -758,7 +758,7 @@ type RateLimitFields struct { // config could include [{claude-v1, claude-v1.3},{claude-instant-v1}]. AllowedModels []string `json:"allowedModels"` // The source of the rate limit configuration. - Source LLMProxyRateLimitSource `json:"source"` + Source CodyGatewayRateLimitSource `json:"source"` // Requests per time interval. Limit int `json:"limit"` // Interval for rate limiting. @@ -769,7 +769,7 @@ type RateLimitFields struct { func (v *RateLimitFields) GetAllowedModels() []string { return v.AllowedModels } // GetSource returns RateLimitFields.Source, and is useful for accessing the field via an interface. -func (v *RateLimitFields) GetSource() LLMProxyRateLimitSource { return v.Source } +func (v *RateLimitFields) GetSource() CodyGatewayRateLimitSource { return v.Source } // GetLimit returns RateLimitFields.Limit, and is useful for accessing the field via an interface. func (v *RateLimitFields) GetLimit() int { return v.Limit } @@ -806,8 +806,8 @@ fragment ProductSubscriptionState on ProductSubscription { id uuid isArchived - llmProxyAccess { - ... LLMProxyAccessFields + codyGatewayAccess { + ... CodyGatewayAccessFields } activeLicense { info { @@ -815,7 +815,7 @@ fragment ProductSubscriptionState on ProductSubscription { } } } -fragment LLMProxyAccessFields on LLMProxyAccess { +fragment CodyGatewayAccessFields on CodyGatewayAccess { enabled chatCompletionsRateLimit { ... RateLimitFields @@ -824,7 +824,7 @@ fragment LLMProxyAccessFields on LLMProxyAccess { ... RateLimitFields } } -fragment RateLimitFields on LLMProxyRateLimit { +fragment RateLimitFields on CodyGatewayRateLimit { allowedModels source limit @@ -878,8 +878,8 @@ fragment ProductSubscriptionState on ProductSubscription { id uuid isArchived - llmProxyAccess { - ... LLMProxyAccessFields + codyGatewayAccess { + ... CodyGatewayAccessFields } activeLicense { info { @@ -887,7 +887,7 @@ fragment ProductSubscriptionState on ProductSubscription { } } } -fragment LLMProxyAccessFields on LLMProxyAccess { +fragment CodyGatewayAccessFields on CodyGatewayAccess { enabled chatCompletionsRateLimit { ... RateLimitFields @@ -896,7 +896,7 @@ fragment LLMProxyAccessFields on LLMProxyAccess { ... RateLimitFields } } -fragment RateLimitFields on LLMProxyRateLimit { +fragment RateLimitFields on CodyGatewayRateLimit { allowedModels source limit diff --git a/enterprise/cmd/cody-gateway/internal/dotcom/operations.graphql b/enterprise/cmd/cody-gateway/internal/dotcom/operations.graphql index cad20835105..3eba15f7391 100644 --- a/enterprise/cmd/cody-gateway/internal/dotcom/operations.graphql +++ b/enterprise/cmd/cody-gateway/internal/dotcom/operations.graphql @@ -1,11 +1,11 @@ -fragment RateLimitFields on LLMProxyRateLimit { +fragment RateLimitFields on CodyGatewayRateLimit { allowedModels source limit intervalSeconds } -fragment LLMProxyAccessFields on LLMProxyAccess { +fragment CodyGatewayAccessFields on CodyGatewayAccess { enabled chatCompletionsRateLimit { ...RateLimitFields @@ -19,8 +19,8 @@ fragment ProductSubscriptionState on ProductSubscription { id uuid isArchived - llmProxyAccess { - ...LLMProxyAccessFields + codyGatewayAccess { + ...CodyGatewayAccessFields } activeLicense { info { diff --git a/enterprise/cmd/cody-gateway/shared/config.go b/enterprise/cmd/cody-gateway/shared/config.go index bcd9d63ca99..f56435d5f85 100644 --- a/enterprise/cmd/cody-gateway/shared/config.go +++ b/enterprise/cmd/cody-gateway/shared/config.go @@ -57,7 +57,7 @@ type TraceConfig struct { func (c *Config) Load() { c.InsecureDev = env.InsecureDev - c.Address = c.Get("CODY_GATEWAY_ADDR", ":9992", "Address to serve LLM proxy on.") + c.Address = c.Get("CODY_GATEWAY_ADDR", ":9992", "Address to serve Cody Gateway on.") c.DiagnosticsSecret = c.GetOptional("CODY_GATEWAY_DIAGNOSTICS_SECRET", "Secret for accessing diagnostics - "+ "should be used as 'Authorization: Bearer $secret' header when accessing diagnostics endpoints.") @@ -73,7 +73,7 @@ func (c *Config) Load() { c.OpenAI.OrgID = c.GetOptional("CODY_GATEWAY_OPENAI_ORG_ID", "The OpenAI organization to count billing towards. Setting this ensures we always use the correct negotiated terms.") c.OpenAI.AllowedModels = splitMaybe(c.Get("CODY_GATEWAY_OPENAI_ALLOWED_MODELS", "gpt-4,gpt-3.5-turbo", "The Anthropic access token to be used.")) - c.AllowAnonymous = c.GetBool("CODY_GATEWAY_ALLOW_ANONYMOUS", "false", "Allow anonymous access to LLM proxy.") + c.AllowAnonymous = c.GetBool("CODY_GATEWAY_ALLOW_ANONYMOUS", "false", "Allow anonymous access to Cody Gateway.") c.SourcesSyncInterval = c.GetInterval("CODY_GATEWAY_SOURCES_SYNC_INTERVAL", "2m", "The interval at which to sync actor sources.") c.BigQuery.ProjectID = c.Get("CODY_GATEWAY_BIGQUERY_PROJECT_ID", os.Getenv("GOOGLE_CLOUD_PROJECT"), "The project ID for the BigQuery events.") diff --git a/enterprise/cmd/cody-gateway/shared/main.go b/enterprise/cmd/cody-gateway/shared/main.go index 4d5168c839d..decad06b1ba 100644 --- a/enterprise/cmd/cody-gateway/shared/main.go +++ b/enterprise/cmd/cody-gateway/shared/main.go @@ -34,7 +34,7 @@ import ( func Main(ctx context.Context, obctx *observation.Context, ready service.ReadyFunc, config *Config) error { // Enable tracing, at this point tracing wouldn't have been enabled yet because - // we run LLM-proxy without conf which means Sourcegraph tracing is not enabled. + // we run Cody Gateway without conf which means Sourcegraph tracing is not enabled. shutdownTracing, err := maybeEnableTracing(ctx, obctx.Logger.Scoped("tracing", "tracing configuration"), config.Trace) @@ -95,7 +95,7 @@ func Main(ctx context.Context, obctx *observation.Context, ready service.ReadyFu handler = instrumentation.HTTPMiddleware("cody-gateway", handler, otelhttpOpts...) // Collect request client for downstream handlers. Outside of dev, we always set up - // Cloudflare in from of LLM-proxy. This comes first. + // Cloudflare in from of Cody Gateway. This comes first. hasCloudflare := !config.InsecureDev handler = requestclient.ExternalHTTPMiddleware(handler, hasCloudflare) diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/BUILD.bazel b/enterprise/cmd/frontend/internal/dotcom/productsubscription/BUILD.bazel index 97a79a8e71f..322511f4e44 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/BUILD.bazel +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/BUILD.bazel @@ -3,13 +3,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "productsubscription", srcs = [ + "codygateway_graphql.go", + "codygateway_service.go", "doc.go", "graphql.go", "license_expiration.go", "licenses_db.go", "licenses_graphql.go", - "llmproxy_graphql.go", - "llmproxyservice.go", "mock_db.go", "service_account.go", "subscriptions_db.go", @@ -56,9 +56,9 @@ go_library( go_test( name = "productsubscription_test", srcs = [ + "codygateway_graphql_test.go", "license_expiration_test.go", "licenses_db_test.go", - "llmproxy_graphql_test.go", "service_account_test.go", "subscriptions_db_test.go", "subscriptions_graphql_test.go", diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql.go similarity index 61% rename from enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql.go rename to enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql.go index 756965468df..464e792ab0b 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql.go @@ -11,13 +11,13 @@ import ( "github.com/sourcegraph/sourcegraph/lib/errors" ) -type llmProxyAccessResolver struct { +type codyGatewayAccessResolver struct { sub *productSubscription } -func (r llmProxyAccessResolver) Enabled() bool { return r.sub.v.LLMProxyAccess.Enabled } +func (r codyGatewayAccessResolver) Enabled() bool { return r.sub.v.LLMProxyAccess.Enabled } -func (r llmProxyAccessResolver) ChatCompletionsRateLimit(ctx context.Context) (graphqlbackend.LLMProxyRateLimit, error) { +func (r codyGatewayAccessResolver) ChatCompletionsRateLimit(ctx context.Context) (graphqlbackend.CodyGatewayRateLimit, error) { if !r.Enabled() { return nil, nil } @@ -31,28 +31,28 @@ func (r llmProxyAccessResolver) ChatCompletionsRateLimit(ctx context.Context) (g if err != nil { return nil, errors.Wrap(err, "could not get active license") } - var source graphqlbackend.LLMProxyRateLimitSource + var source graphqlbackend.CodyGatewayRateLimitSource if activeLicense != nil { - source = graphqlbackend.LLMProxyRateLimitSourcePlan + source = graphqlbackend.CodyGatewayRateLimitSourcePlan rateLimit = licensing.NewCodyGatewayChatRateLimit(licensing.PlanFromTags(activeLicense.LicenseTags), activeLicense.LicenseUserCount, activeLicense.LicenseTags) } // Apply overrides rateLimitOverrides := r.sub.v.LLMProxyAccess if rateLimitOverrides.ChatRateLimit.RateLimit != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.Limit = *rateLimitOverrides.ChatRateLimit.RateLimit } if rateLimitOverrides.ChatRateLimit.RateIntervalSeconds != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.IntervalSeconds = *rateLimitOverrides.ChatRateLimit.RateIntervalSeconds } if rateLimitOverrides.ChatRateLimit.AllowedModels != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.AllowedModels = rateLimitOverrides.ChatRateLimit.AllowedModels } - return &llmProxyRateLimitResolver{ + return &codyGatewayRateLimitResolver{ feature: types.CompletionsFeatureChat, subUUID: r.sub.UUID(), v: rateLimit, @@ -60,7 +60,7 @@ func (r llmProxyAccessResolver) ChatCompletionsRateLimit(ctx context.Context) (g }, nil } -func (r llmProxyAccessResolver) CodeCompletionsRateLimit(ctx context.Context) (graphqlbackend.LLMProxyRateLimit, error) { +func (r codyGatewayAccessResolver) CodeCompletionsRateLimit(ctx context.Context) (graphqlbackend.CodyGatewayRateLimit, error) { if !r.Enabled() { return nil, nil } @@ -74,28 +74,28 @@ func (r llmProxyAccessResolver) CodeCompletionsRateLimit(ctx context.Context) (g if err != nil { return nil, errors.Wrap(err, "could not get active license") } - var source graphqlbackend.LLMProxyRateLimitSource + var source graphqlbackend.CodyGatewayRateLimitSource if activeLicense != nil { - source = graphqlbackend.LLMProxyRateLimitSourcePlan + source = graphqlbackend.CodyGatewayRateLimitSourcePlan rateLimit = licensing.NewCodyGatewayCodeRateLimit(licensing.PlanFromTags(activeLicense.LicenseTags), activeLicense.LicenseUserCount, activeLicense.LicenseTags) } // Apply overrides rateLimitOverrides := r.sub.v.LLMProxyAccess if rateLimitOverrides.CodeRateLimit.RateLimit != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.Limit = *rateLimitOverrides.CodeRateLimit.RateLimit } if rateLimitOverrides.CodeRateLimit.RateIntervalSeconds != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.IntervalSeconds = *rateLimitOverrides.CodeRateLimit.RateIntervalSeconds } if rateLimitOverrides.CodeRateLimit.AllowedModels != nil { - source = graphqlbackend.LLMProxyRateLimitSourceOverride + source = graphqlbackend.CodyGatewayRateLimitSourceOverride rateLimit.AllowedModels = rateLimitOverrides.CodeRateLimit.AllowedModels } - return &llmProxyRateLimitResolver{ + return &codyGatewayRateLimitResolver{ feature: types.CompletionsFeatureCode, subUUID: r.sub.UUID(), v: rateLimit, @@ -103,30 +103,32 @@ func (r llmProxyAccessResolver) CodeCompletionsRateLimit(ctx context.Context) (g }, nil } -type llmProxyRateLimitResolver struct { +type codyGatewayRateLimitResolver struct { subUUID string feature types.CompletionsFeature - source graphqlbackend.LLMProxyRateLimitSource + source graphqlbackend.CodyGatewayRateLimitSource v licensing.CodyGatewayRateLimit } -func (r *llmProxyRateLimitResolver) Source() graphqlbackend.LLMProxyRateLimitSource { return r.source } +func (r *codyGatewayRateLimitResolver) Source() graphqlbackend.CodyGatewayRateLimitSource { + return r.source +} -func (r *llmProxyRateLimitResolver) AllowedModels() []string { return r.v.AllowedModels } +func (r *codyGatewayRateLimitResolver) AllowedModels() []string { return r.v.AllowedModels } -func (r *llmProxyRateLimitResolver) Limit() int32 { return r.v.Limit } +func (r *codyGatewayRateLimitResolver) Limit() int32 { return r.v.Limit } -func (r *llmProxyRateLimitResolver) IntervalSeconds() int32 { return r.v.IntervalSeconds } +func (r *codyGatewayRateLimitResolver) IntervalSeconds() int32 { return r.v.IntervalSeconds } -func (r llmProxyRateLimitResolver) Usage(ctx context.Context) ([]graphqlbackend.LLMProxyUsageDatapoint, error) { - usage, err := NewLLMProxyService().UsageForSubscription(ctx, r.feature, r.subUUID) +func (r codyGatewayRateLimitResolver) Usage(ctx context.Context) ([]graphqlbackend.CodyGatewayUsageDatapoint, error) { + usage, err := NewCodyGatewayService().UsageForSubscription(ctx, r.feature, r.subUUID) if err != nil { return nil, err } - resolvers := make([]graphqlbackend.LLMProxyUsageDatapoint, 0, len(usage)) + resolvers := make([]graphqlbackend.CodyGatewayUsageDatapoint, 0, len(usage)) for _, u := range usage { - resolvers = append(resolvers, &llmProxyUsageDatapoint{ + resolvers = append(resolvers, &codyGatewayUsageDatapoint{ date: u.Date, model: u.Model, count: u.Count, @@ -136,20 +138,20 @@ func (r llmProxyRateLimitResolver) Usage(ctx context.Context) ([]graphqlbackend. return resolvers, nil } -type llmProxyUsageDatapoint struct { +type codyGatewayUsageDatapoint struct { date time.Time model string count int } -func (r *llmProxyUsageDatapoint) Date() gqlutil.DateTime { +func (r *codyGatewayUsageDatapoint) Date() gqlutil.DateTime { return gqlutil.DateTime{Time: r.date} } -func (r *llmProxyUsageDatapoint) Model() string { +func (r *codyGatewayUsageDatapoint) Model() string { return r.model } -func (r *llmProxyUsageDatapoint) Count() int32 { +func (r *codyGatewayUsageDatapoint) Count() int32 { return int32(r.count) } diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql_test.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql_test.go similarity index 85% rename from enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql_test.go rename to enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql_test.go index 743a753624f..dadcfbddf4c 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxy_graphql_test.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_graphql_test.go @@ -18,7 +18,7 @@ import ( "github.com/sourcegraph/sourcegraph/internal/timeutil" ) -func TestLLMProxyAccessResolverRateLimit(t *testing.T) { +func TestCodeGatewayAccessResolverRateLimit(t *testing.T) { logger := logtest.Scoped(t) db := database.NewDB(logger, dbtest.NewDB(logger, t)) ctx := context.Background() @@ -36,27 +36,27 @@ func TestLLMProxyAccessResolverRateLimit(t *testing.T) { _, err = dbLicenses{db: db}.Create(ctx, subID, "k2", 1, info) require.NoError(t, err) - // Enable access to LLM proxy. + // Enable access to Cody Gateway. tru := true - err = dbSubscriptions{db: db}.Update(ctx, subID, dbSubscriptionUpdate{llmProxyAccess: &graphqlbackend.UpdateLLMProxyAccessInput{Enabled: &tru}}) + err = dbSubscriptions{db: db}.Update(ctx, subID, dbSubscriptionUpdate{codyGatewayAccess: &graphqlbackend.UpdateCodyGatewayAccessInput{Enabled: &tru}}) require.NoError(t, err) t.Run("default rate limit for a plan", func(t *testing.T) { sub, err := dbSubscriptions{db: db}.GetByID(ctx, subID) require.NoError(t, err) - r := llmProxyAccessResolver{sub: &productSubscription{v: sub, db: db}} - wantRateLimit := licensing.NewCodyGatewayChatRateLimit(licensing.PlanEnterprise1, pointify(int(info.UserCount)), []string{}) + r := codyGatewayAccessResolver{sub: &productSubscription{v: sub, db: db}} rateLimit, err := r.ChatCompletionsRateLimit(ctx) require.NoError(t, err) + wantRateLimit := licensing.NewCodyGatewayChatRateLimit(licensing.PlanEnterprise1, pointify(int(info.UserCount)), []string{}) assert.Equal(t, wantRateLimit.Limit, rateLimit.Limit()) assert.Equal(t, wantRateLimit.IntervalSeconds, rateLimit.IntervalSeconds()) }) t.Run("override default rate limit for a plan", func(t *testing.T) { err := (dbSubscriptions{db: db}.Update(ctx, subID, dbSubscriptionUpdate{ - llmProxyAccess: &graphqlbackend.UpdateLLMProxyAccessInput{ + codyGatewayAccess: &graphqlbackend.UpdateCodyGatewayAccessInput{ ChatCompletionsRateLimit: pointify(int32(10)), }, })) @@ -65,11 +65,11 @@ func TestLLMProxyAccessResolverRateLimit(t *testing.T) { sub, err := dbSubscriptions{db: db}.GetByID(ctx, subID) require.NoError(t, err) - r := llmProxyAccessResolver{sub: &productSubscription{v: sub, db: db}} - defaultRateLimit := licensing.NewCodyGatewayChatRateLimit(licensing.PlanEnterprise1, pointify(10), []string{}) + r := codyGatewayAccessResolver{sub: &productSubscription{v: sub, db: db}} rateLimit, err := r.ChatCompletionsRateLimit(ctx) require.NoError(t, err) + defaultRateLimit := licensing.NewCodyGatewayChatRateLimit(licensing.PlanEnterprise1, pointify(10), []string{}) assert.Equal(t, int32(10), rateLimit.Limit()) assert.Equal(t, defaultRateLimit.IntervalSeconds, rateLimit.IntervalSeconds()) }) diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxyservice.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_service.go similarity index 77% rename from enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxyservice.go rename to enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_service.go index c690e9f7de9..cacddf9418b 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/llmproxyservice.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/codygateway_service.go @@ -16,13 +16,18 @@ import ( "github.com/sourcegraph/sourcegraph/lib/errors" ) -var llmProxySACredentialFilePath = env.Get("LLM_PROXY_BIGQUERY_ACCESS_CREDENTIALS_FILE", "", "") +var codyGatewaySACredentialFilePath = func() string { + if v := env.Get("CODY_GATEWAY_BIGQUERY_ACCESS_CREDENTIALS_FILE", "", "BigQuery credentials for the Cody Gateway service"); v != "" { + return v + } + return env.Get("LLM_PROXY_BIGQUERY_ACCESS_CREDENTIALS_FILE", "", "DEPRECATED: Use CODY_GATEWAY_BIGQUERY_ACCESS_CREDENTIALS_FILE instead") +}() -type LLMProxyService interface { +type CodyGatewayService interface { UsageForSubscription(ctx context.Context, uuid string) ([]SubscriptionUsage, error) } -type LLMProxyServiceOptions struct { +type CodyGatewayServiceOptions struct { BigQuery ServiceBigQueryOptions } @@ -37,22 +42,22 @@ func (o ServiceBigQueryOptions) IsConfigured() bool { return o.ProjectID != "" && o.Dataset != "" && o.EventsTable != "" } -func NewLLMProxyService() *llmProxyService { - opts := LLMProxyServiceOptions{} +func NewCodyGatewayService() *codyGatewayService { + opts := CodyGatewayServiceOptions{} d := conf.Get().Dotcom - if d != nil && d.LlmProxy != nil { - opts.BigQuery.CredentialFilePath = llmProxySACredentialFilePath - opts.BigQuery.ProjectID = d.LlmProxy.BigQueryGoogleProjectID - opts.BigQuery.Dataset = d.LlmProxy.BigQueryDataset - opts.BigQuery.EventsTable = d.LlmProxy.BigQueryTable + if d != nil && d.CodyGateway != nil { + opts.BigQuery.CredentialFilePath = codyGatewaySACredentialFilePath + opts.BigQuery.ProjectID = d.CodyGateway.BigQueryGoogleProjectID + opts.BigQuery.Dataset = d.CodyGateway.BigQueryDataset + opts.BigQuery.EventsTable = d.CodyGateway.BigQueryTable } - return NewLLMProxyServiceWithOptions(opts) + return NewCodyGatewayServiceWithOptions(opts) } -func NewLLMProxyServiceWithOptions(opts LLMProxyServiceOptions) *llmProxyService { - return &llmProxyService{ +func NewCodyGatewayServiceWithOptions(opts CodyGatewayServiceOptions) *codyGatewayService { + return &codyGatewayService{ opts: opts, } } @@ -63,11 +68,11 @@ type SubscriptionUsage struct { Count int } -type llmProxyService struct { - opts LLMProxyServiceOptions +type codyGatewayService struct { + opts CodyGatewayServiceOptions } -func (s *llmProxyService) UsageForSubscription(ctx context.Context, feature types.CompletionsFeature, uuid string) ([]SubscriptionUsage, error) { +func (s *codyGatewayService) UsageForSubscription(ctx context.Context, feature types.CompletionsFeature, uuid string) ([]SubscriptionUsage, error) { if !s.opts.BigQuery.IsConfigured() { // Not configured, nothing we can do. return nil, nil diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db.go index 214689638a8..46fa57c52b8 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db.go @@ -23,6 +23,7 @@ type dbRateLimit struct { RateIntervalSeconds *int32 } +// TODO(@bobheadxi): Rename when DB columns are renamed. type dbLLMProxyAccess struct { Enabled bool ChatRateLimit dbRateLimit @@ -38,7 +39,9 @@ type dbSubscription struct { CreatedAt time.Time ArchivedAt *time.Time AccountNumber *string - LLMProxyAccess dbLLMProxyAccess + + // TODO(@bobheadxi): Rename when DB columns are renamed. + LLMProxyAccess dbLLMProxyAccess } var emailQueries = sqlf.Sprintf(`all_primary_emails AS ( @@ -212,7 +215,7 @@ WHERE (%s)`, emailQueries, sqlf.Join(opt.sqlConditions(), ") AND (")) // value is nil, the field remains unchanged in the database. type dbSubscriptionUpdate struct { billingSubscriptionID *sql.NullString - llmProxyAccess *graphqlbackend.UpdateLLMProxyAccessInput + codyGatewayAccess *graphqlbackend.UpdateCodyGatewayAccessInput } // Update updates a product subscription. @@ -223,7 +226,7 @@ func (s dbSubscriptions) Update(ctx context.Context, id string, update dbSubscri if v := update.billingSubscriptionID; v != nil { fieldUpdates = append(fieldUpdates, sqlf.Sprintf("billing_subscription_id=%s", *v)) } - if access := update.llmProxyAccess; access != nil { + if access := update.codyGatewayAccess; access != nil { if v := access.Enabled; v != nil { fieldUpdates = append(fieldUpdates, sqlf.Sprintf("llm_proxy_enabled=%s", *v)) } diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db_test.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db_test.go index ec6a931d6d6..dfb83bb064a 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db_test.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_db_test.go @@ -155,10 +155,10 @@ func TestProductSubscriptions_Update(t *testing.T) { }) }) - t.Run("llmProxyAccess", func(t *testing.T) { + t.Run("codyGatewayAccess", func(t *testing.T) { t.Run("set non-null values", func(t *testing.T) { err := subscriptions.Update(ctx, sub0, dbSubscriptionUpdate{ - llmProxyAccess: &graphqlbackend.UpdateLLMProxyAccessInput{ + codyGatewayAccess: &graphqlbackend.UpdateCodyGatewayAccessInput{ Enabled: pointify(true), ChatCompletionsRateLimit: pointify(int32(12)), ChatCompletionsRateLimitIntervalSeconds: pointify(int32(time.Hour.Seconds())), @@ -178,7 +178,7 @@ func TestProductSubscriptions_Update(t *testing.T) { t.Run("set to zero/null values", func(t *testing.T) { err := subscriptions.Update(ctx, sub0, dbSubscriptionUpdate{ - llmProxyAccess: &graphqlbackend.UpdateLLMProxyAccessInput{ + codyGatewayAccess: &graphqlbackend.UpdateCodyGatewayAccessInput{ Enabled: pointify(false), ChatCompletionsRateLimit: pointify(int32(0)), ChatCompletionsRateLimitIntervalSeconds: pointify(int32(0)), diff --git a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_graphql.go b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_graphql.go index 3ecb679cf65..c05309bbb1a 100644 --- a/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_graphql.go +++ b/enterprise/cmd/frontend/internal/dotcom/productsubscription/subscriptions_graphql.go @@ -133,8 +133,8 @@ func (r *productSubscription) ProductLicenses(ctx context.Context, args *graphql return &productLicenseConnection{db: r.db, opt: opt}, nil } -func (r *productSubscription) LLMProxyAccess() graphqlbackend.LLMProxyAccess { - return llmProxyAccessResolver{sub: r} +func (r *productSubscription) CodyGatewayAccess() graphqlbackend.CodyGatewayAccess { + return codyGatewayAccessResolver{sub: r} } func (r *productSubscription) CurrentSourcegraphAccessToken(ctx context.Context) (*string, error) { @@ -236,7 +236,7 @@ func (r ProductSubscriptionLicensingResolver) UpdateProductSubscription(ctx cont return nil, err } if err := (dbSubscriptions{db: r.DB}).Update(ctx, sub.v.ID, dbSubscriptionUpdate{ - llmProxyAccess: args.Update.LLMProxyAccess, + codyGatewayAccess: args.Update.CodyGatewayAccess, }); err != nil { return nil, err } diff --git a/enterprise/internal/completions/client/client.go b/enterprise/internal/completions/client/client.go index 64d3c8975cf..b7ebaaf7f31 100644 --- a/enterprise/internal/completions/client/client.go +++ b/enterprise/internal/completions/client/client.go @@ -70,7 +70,7 @@ func GetCompletionsConfig() *schema.Completions { Enabled: len(appConfig.DotcomAuthToken) > 0, Provider: dotcom.ProviderName, // TODO: These are not required right now as upstream overwrites this, - // but should we switch to LLM Proxy they will be. + // but should we switch to Cody Gateway they will be. ChatModel: "claude-v1", CompletionModel: "claude-instant-v1", } diff --git a/enterprise/internal/licensing/tags.go b/enterprise/internal/licensing/tags.go index 6d89322cd3a..353904ece68 100644 --- a/enterprise/internal/licensing/tags.go +++ b/enterprise/internal/licensing/tags.go @@ -17,7 +17,7 @@ const ( // DevTag denotes licenses used in development environments DevTag = "dev" // GPTLLMAccessTag is the license tag that indicates that the licensed instance - // should be allowed by default to use GPT models in LLM Proxy. + // should be allowed by default to use GPT models in Cody Gateway. GPTLLMAccessTag = "gpt" // AllowAnonymousUsageTag denotes licenses that allow anonymous usage, a.k.a public access to the instance // Warning: This should be used with care and only at special, probably trial/poc stages with customers diff --git a/schema/schema.go b/schema/schema.go index c269a7d320e..05ee8a05e1e 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -540,6 +540,16 @@ type CloudKMSEncryptionKey struct { Type string `json:"type"` } +// CodyGateway description: Configuration related to the Cody Gateway service management. This should only be used on sourcegraph.com. +type CodyGateway struct { + // BigQueryDataset description: The dataset to pull BigQuery Cody Gateway related events from. + BigQueryDataset string `json:"bigQueryDataset,omitempty"` + // BigQueryGoogleProjectID description: The project ID to pull BigQuery Cody Gatewayrelated events from. + BigQueryGoogleProjectID string `json:"bigQueryGoogleProjectID,omitempty"` + // BigQueryTable description: The table in the dataset to pull BigQuery Cody Gateway related events from. + BigQueryTable string `json:"bigQueryTable,omitempty"` +} + // Completions description: Configuration for the completions service. type Completions struct { // AccessToken description: The access token used to authenticate with the external completions provider. @@ -580,8 +590,8 @@ type DebugLog struct { type Dotcom struct { // AppNotifications description: Notifications to display in the Sourcegraph app. AppNotifications []*AppNotifications `json:"app.notifications,omitempty"` - // LlmProxy description: Configuration related to the LLM Proxy service management. This should only be used on sourcegraph.com. - LlmProxy *LlmProxy `json:"llmProxy,omitempty"` + // CodyGateway description: Configuration related to the Cody Gateway service management. This should only be used on sourcegraph.com. + CodyGateway *CodyGateway `json:"codyGateway,omitempty"` // SlackLicenseExpirationWebhook description: Slack webhook for upcoming license expiration notifications. SlackLicenseExpirationWebhook string `json:"slackLicenseExpirationWebhook,omitempty"` // SrcCliVersionCache description: Configuration related to the src-cli version cache. This should only be used on sourcegraph.com. @@ -1352,16 +1362,6 @@ type JVMPackagesConnection struct { Maven Maven `json:"maven"` } -// LlmProxy description: Configuration related to the LLM Proxy service management. This should only be used on sourcegraph.com. -type LlmProxy struct { - // BigQueryDataset description: The dataset to pull BigQuery LLM Proxy related events from. - BigQueryDataset string `json:"bigQueryDataset,omitempty"` - // BigQueryGoogleProjectID description: The project ID to pull BigQuery LLM Proxy related events from. - BigQueryGoogleProjectID string `json:"bigQueryGoogleProjectID,omitempty"` - // BigQueryTable description: The table in the dataset to pull BigQuery LLM Proxy related events from. - BigQueryTable string `json:"bigQueryTable,omitempty"` -} - // Log description: Configuration for logging and alerting, including to external services. type Log struct { // AuditLog description: EXPERIMENTAL: Configuration for audit logging (specially formatted log entries for tracking sensitive events) diff --git a/schema/site.schema.json b/schema/site.schema.json index e01c0874752..ae7ca15a58c 100644 --- a/schema/site.schema.json +++ b/schema/site.schema.json @@ -1954,21 +1954,21 @@ } } }, - "llmProxy": { - "description": "Configuration related to the LLM Proxy service management. This should only be used on sourcegraph.com.", + "codyGateway": { + "description": "Configuration related to the Cody Gateway service management. This should only be used on sourcegraph.com.", "type": "object", "group": "Sourcegraph.com", "properties": { "bigQueryGoogleProjectID": { - "description": "The project ID to pull BigQuery LLM Proxy related events from.", + "description": "The project ID to pull BigQuery Cody Gatewayrelated events from.", "type": "string" }, "bigQueryDataset": { - "description": "The dataset to pull BigQuery LLM Proxy related events from.", + "description": "The dataset to pull BigQuery Cody Gateway related events from.", "type": "string" }, "bigQueryTable": { - "description": "The table in the dataset to pull BigQuery LLM Proxy related events from.", + "description": "The table in the dataset to pull BigQuery Cody Gateway related events from.", "type": "string" } } diff --git a/sg.config.yaml b/sg.config.yaml index 566e95a0fee..09a76243365 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -1196,7 +1196,7 @@ commandsets: EXTSVC_CONFIG_FILE: "" dotcom: - # This is 95% the enterprise runset, with the addition of LLM-proxy. + # This is 95% the enterprise runset, with the addition of Cody Gateway. requiresDevPrivate: true checks: - docker
- + {rateLimit.limit} requests / {prettyInterval(rateLimit.intervalSeconds)} @@ -288,28 +288,28 @@ const RateLimitRow: React.FunctionComponent = ({ > - {rateLimit.source === LLMProxyRateLimitSource.OVERRIDE && ( + {rateLimit.source === CodyGatewayRateLimitSource.OVERRIDE && ( )} - {updateLLMProxyConfigError && } + {updateCodyGatewayConfigError && }