test: azure pathname
This commit is contained in:
parent
22adae6157
commit
066c595ed7
1 changed files with 76 additions and 0 deletions
|
|
@ -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