ci: don't run api key tests for oai adapters on contributors' prs
This commit is contained in:
parent
50ae6869d2
commit
a6a173db75
2 changed files with 24 additions and 13 deletions
1
.github/workflows/pr_checks.yaml
vendored
1
.github/workflows/pr_checks.yaml
vendored
|
|
@ -598,6 +598,7 @@ jobs:
|
|||
cd packages/openai-adapters
|
||||
npm test
|
||||
env:
|
||||
IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { DEEPSEEK_API_BASE } from "../apis/DeepSeek.js";
|
|||
import { INCEPTION_API_BASE } from "../apis/Inception.js";
|
||||
import { OpenAIApi } from "../apis/OpenAI.js";
|
||||
import { constructLlmApi } from "../index.js";
|
||||
import { getLlmApi, testChat, testEmbed } from "./util.js";
|
||||
import { getLlmApi, testChat, testEmbed, testFim, testRerank } from "./util.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
|
@ -35,8 +35,12 @@ function testConfig(_config: ModelConfig & { options?: TestConfigOptions }) {
|
|||
testEmbed(api, model);
|
||||
}
|
||||
|
||||
if (config.roles?.includes("embed")) {
|
||||
testEmbed(api, model);
|
||||
if (config.roles?.includes("rerank")) {
|
||||
testRerank(api, model);
|
||||
}
|
||||
|
||||
if (config.roles?.includes("autocomplete")) {
|
||||
testFim(api, model);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +74,12 @@ const TESTS: Omit<ModelConfig & { options?: TestConfigOptions }, "name">[] = [
|
|||
apiBase: "https://api.mistral.ai/v1",
|
||||
roles: ["autocomplete"],
|
||||
},
|
||||
{
|
||||
provider: "deepseek",
|
||||
model: "deepseek-coder",
|
||||
apiKey: process.env.DEEPSEEK_API_KEY!,
|
||||
roles: ["autocomplete"],
|
||||
},
|
||||
// {
|
||||
// provider: "deepseek",
|
||||
// model: "deepseek-coder",
|
||||
// apiKey: process.env.DEEPSEEK_API_KEY!,
|
||||
// roles: ["autocomplete"],
|
||||
// },
|
||||
{
|
||||
provider: "openai",
|
||||
model: "text-embedding-3-small",
|
||||
|
|
@ -126,11 +130,17 @@ const TESTS: Omit<ModelConfig & { options?: TestConfigOptions }, "name">[] = [
|
|||
},
|
||||
];
|
||||
|
||||
TESTS.forEach((config) => {
|
||||
describe(`${config.provider}/${config.model}`, () => {
|
||||
testConfig({ name: config.model, ...config });
|
||||
if (process.env.IGNORE_API_KEY_TESTS === "true") {
|
||||
test("Skipping API key tests", () => {
|
||||
console.log("Skipping API key tests due to IGNORE_API_KEY_TESTS being set");
|
||||
});
|
||||
});
|
||||
} else {
|
||||
TESTS.forEach((config) => {
|
||||
describe(`${config.provider}/${config.model}`, () => {
|
||||
testConfig({ name: config.model, ...config });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe("Configuration", () => {
|
||||
it("should configure DeepSeek OpenAI client with correct apiBase and apiKey", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue