Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions packages/gateway/__tests__/data-plane/openai-images/http_test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/provider-azure/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export const createAzureProvider = (record: UpstreamRecord): Provider => {
callOpenAIImagesGenerations: (model, body, signal, opts) => callNonStreaming(azureFetchOpenAIImagesGenerations, model, body, signal, [...opts.headers], opts),
callOpenAIImagesEdits: async (model, request, signal, opts) => {
const upstreamModelId = upstreamModelIdOf(model);
const body = await serializeOpenAIImagesEditsRequest(request, upstreamModelId);
const response = await azureFetchOpenAIImagesEdits(azure.config, { method: 'POST', body, signal }, { extraHeaders: [...opts.headers], fetcher: opts.fetcher, wrapUpstreamCall: opts.wrapUpstreamCall });
const serialized = await serializeOpenAIImagesEditsRequest(request, upstreamModelId);
const response = await azureFetchOpenAIImagesEdits(azure.config, { method: 'POST', ...serialized, signal }, { extraHeaders: [...opts.headers], fetcher: opts.fetcher, wrapUpstreamCall: opts.wrapUpstreamCall });
return { response, modelKey: upstreamModelId };
},
callOpenAIAudioTranscriptions: async (model, request, signal, opts) => {
Expand Down
35 changes: 34 additions & 1 deletion packages/provider-copilot/__tests__/auth_test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 78 additions & 1 deletion packages/provider-copilot/__tests__/provider_test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/provider-copilot/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ export async function copilotAuthedFetch(path: string, init: FetchInit, auth: Co
if (ownedInit === undefined) throw new Error('Copilot request ownership missing before dispatch');
const headers = new Headers(ownedInit.headers);
headers.set('Authorization', `Bearer ${entry.token}`);
headers.set('Content-Type', 'application/json');
headers.set('editor-version', EDITOR_VERSION);
headers.set('editor-plugin-version', EDITOR_PLUGIN_VERSION);
headers.set('editor-device-id', getEditorDeviceId());
Expand Down
1 change: 0 additions & 1 deletion packages/provider-copilot/src/fetch-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const isCopilotModelsResponse = (value: unknown): value is CopilotModelsResponse
const MODELS_HEADER_OVERRIDES: HttpHeaderLines = [
['openai-intent', 'model-access'],
['x-interaction-type', 'model-access'],
['content-type', ''],
];

export const fetchCopilotModels = (config: CopilotFetchConfig, fetcher: Fetcher): Promise<CopilotModelsResponse> =>
Expand Down
6 changes: 6 additions & 0 deletions packages/provider-copilot/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export const copilotFetchAnthropicMessagesCountTokens = (config: CopilotFetchCon
copilotFetchInternal(config, '/v1/messages/count_tokens', init, options);
export const copilotFetchOpenAIEmbeddings = (config: CopilotFetchConfig, init: FetchInit, options: CopilotDataPlaneFetchOptions): Promise<Response> =>
copilotFetchInternal(config, '/embeddings', init, options);
// https://developers.openai.com/api/reference/resources/images/methods/generate
export const copilotFetchOpenAIImagesGenerations = (config: CopilotFetchConfig, init: FetchInit, options: CopilotDataPlaneFetchOptions): Promise<Response> =>
copilotFetchInternal(config, '/v1/images/generations', init, options);
// https://developers.openai.com/api/reference/resources/images/methods/edit
export const copilotFetchOpenAIImagesEdits = (config: CopilotFetchConfig, init: FetchInit, options: CopilotDataPlaneFetchOptions): Promise<Response> =>
copilotFetchInternal(config, '/v1/images/edits', init, options);
export const copilotFetchModels = (config: CopilotFetchConfig, init: FetchInit, options: CopilotDataPlaneFetchOptions): Promise<Response> =>
copilotFetchInternal(config, '/models', init, options);
// Copilot serves decision models at the System One path it advertises in
Expand Down
Loading
Loading