Merge pull request #6296 from continuedev/tomasz/fix-azure-adapter
fix: azure adapter
This commit is contained in:
commit
bb04586b8f
8 changed files with 95 additions and 10 deletions
11
core/package-lock.json
generated
11
core/package-lock.json
generated
|
|
@ -16,7 +16,7 @@
|
|||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.14",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/openai-adapters": "1.0.42",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
},
|
||||
"../packages/config-yaml": {
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.94",
|
||||
"version": "1.0.95",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
|
@ -150,10 +150,15 @@
|
|||
"config-yaml": "dist/cli.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^9.2.6",
|
||||
"@semantic-release/npm": "^10.0.6",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^20.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"jest": "^29.7.0",
|
||||
"semantic-release": "^21.1.2",
|
||||
"ts-jest": "^29.2.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"zod-to-json-schema": "^3.24.5"
|
||||
|
|
@ -161,7 +166,7 @@
|
|||
},
|
||||
"../packages/openai-adapters": {
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.40",
|
||||
"version": "1.0.42",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.14",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/openai-adapters": "1.0.42",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
|
|||
pluginName=continue-intellij-extension
|
||||
pluginRepositoryUrl=https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion=1.0.25
|
||||
pluginVersion=1.0.26
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild=223
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "1.1.51",
|
||||
"version": "1.1.52",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
4
packages/openai-adapters/package-lock.json
generated
4
packages/openai-adapters/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.40",
|
||||
"version": "1.0.42",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.40",
|
||||
"version": "1.0.42",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@continuedev/openai-adapters",
|
||||
"version": "1.0.40",
|
||||
"version": "1.0.42",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
|||
|
|
@ -63,7 +63,11 @@ export class AzureApi extends OpenAIApi {
|
|||
"`env.apiVersion` is a required configuration property for Azure OpenAI",
|
||||
);
|
||||
}
|
||||
url.pathname = `${url.pathname}/openai/deployments/${config.env.deployment}`;
|
||||
|
||||
const basePathname = `openai/deployments/${config.env.deployment}`;
|
||||
|
||||
url.pathname =
|
||||
url.pathname === "/" ? basePathname : `${url.pathname}/${basePathname}`;
|
||||
|
||||
queryParams["api-version"] = config.env.apiVersion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,4 +173,80 @@ describe("Configuration", () => {
|
|||
"https://api.example.com",
|
||||
);
|
||||
});
|
||||
|
||||
it("should configure Azure OpenAI client with root URL and trailing slash", () => {
|
||||
const azure = constructLlmApi({
|
||||
provider: "azure",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://test-azure-openai.azure.com/",
|
||||
env: {
|
||||
deployment: "gpt-4.1",
|
||||
apiType: "azure-openai",
|
||||
apiVersion: "2023-05-15",
|
||||
},
|
||||
});
|
||||
|
||||
// The Azure client modifies the baseURL to include the deployment
|
||||
expect((azure as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://test-azure-openai.azure.com/openai/deployments/gpt-4.1",
|
||||
);
|
||||
expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
});
|
||||
|
||||
it("should configure Azure OpenAI client with path and trailing slash", () => {
|
||||
const azure = constructLlmApi({
|
||||
provider: "azure",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://test-azure-openai.azure.com/v1/",
|
||||
env: {
|
||||
deployment: "gpt-4.1",
|
||||
apiType: "azure-openai",
|
||||
apiVersion: "2023-05-15",
|
||||
},
|
||||
});
|
||||
|
||||
// The Azure client modifies the baseURL to include the deployment
|
||||
expect((azure as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1",
|
||||
);
|
||||
expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
});
|
||||
|
||||
it("should configure Azure OpenAI client with root URL and no trailing slash", () => {
|
||||
const azure = constructLlmApi({
|
||||
provider: "azure",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://test-azure-openai.azure.com",
|
||||
env: {
|
||||
deployment: "gpt-4.1",
|
||||
apiType: "azure-openai",
|
||||
apiVersion: "2023-05-15",
|
||||
},
|
||||
});
|
||||
|
||||
// The Azure client modifies the baseURL to include the deployment
|
||||
expect((azure as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://test-azure-openai.azure.com/openai/deployments/gpt-4.1",
|
||||
);
|
||||
expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
});
|
||||
|
||||
it("should configure Azure OpenAI client with path and no trailing slash", () => {
|
||||
const azure = constructLlmApi({
|
||||
provider: "azure",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://test-azure-openai.azure.com/v1",
|
||||
env: {
|
||||
deployment: "gpt-4.1",
|
||||
apiType: "azure-openai",
|
||||
apiVersion: "2023-05-15",
|
||||
},
|
||||
});
|
||||
|
||||
// The Azure client modifies the baseURL to include the deployment
|
||||
expect((azure as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1",
|
||||
);
|
||||
expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue