mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:51:55 +00:00
Fixes CODY-3081 This is the first PR for the project [⏭️ Launch Cody API Experimental](https://linear.app/sourcegraph/project/launch-cody-api-experimental-8fd5ec338bf4), which falls under the umbrella of moving Cody's brains to the cloud. Previously, there was no publicly available REST API for our customers to interact with Cody. This is a frequently requested feature from customers and prospects. This PR adds a new `POST /api/v1/chat/completions` endpoint, which should be compatible with existing OpenAI clients. The OpenAI API format is increasingly becoming an industry standard so this seems like a good first step towards exposing a stable publicly facing API for our customers. The goal is to add more Cody-specific APIs in the coming weeks to send chat messages and reference context. <!-- PR description tips: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e --> ## Test plan See added test cases. <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog * API: new publicly available `/api/v1/chat/completions` REST endpoint that is compatible with OpenAI clients with some restrictions. The detailed list of restrictions will eventually be documented on sourcegraph.com/docs <!-- OPTIONAL; info at https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c -->
7 lines
348 B
Bash
Executable File
7 lines
348 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
GOLLY_DOTCOM_ACCESS_TOKEN="$(gcloud secrets versions access latest --secret CODY_PRO_ACCESS_TOKEN --project cody-agent-tokens --quiet)"
|
|
export GOLLY_DOTCOM_ACCESS_TOKEN
|
|
GOLLY_S2_ACCESS_TOKEN="$(gcloud secrets versions access latest --secret CODY_S2_ACCESS_TOKEN --project cody-agent-tokens --quiet)"
|
|
export GOLLY_S2_ACCESS_TOKEN
|