* allow setting apiBase for bedrock provider * ⚡️ better linking * ✨ new prompt file action * ⚡️ strip <COMPLETION> from GPT-4 completion * continue proxy FIM support * warn user if potentially dangerous command is generated * tab autocomplete docs * docs: update PR template (#1531) * chore: add docs to install script (#1533) * fix(extensions): schema for db ctx provider (#1534) * fix(extensions): schema for db ctx provider * fix: invalid enum * prettierignore * docs: add docs and schema for "OS" provider (#1536) * tests (#1501) * 👷 CI for jetbrains * default working dir * changelog * build binaries * binary testing setup * idesettings * core binary testing * run binary tests in ci * remove unused targets * needs build * console.log bin contents * fix ci * fix win32 binary download * test * no linux arm64 * macos latest * macos-12 * binary permissions * upload logs * fix * upload full folder as binary artifact * test * test macos only * set full execute permissions * copy sqlite binary * cd * it worked! * build again in test job * debug * remove timeout * info * log * log2 * more logs * catch * fewer logs * test all platforms * test downloaded artifact * needs build * updates * build * false * release * add tag and upload binaryes * change tag name * proper artifact upload * jest updates * ✅ generate a few unit tests with Continue * fix imports related to IdeSettings * run tsc on PRs * remove shareSession command (unused) * update release process * update plugin version * don't show ghost text when jetbrains completion visible * run jetbrains ci in main * check ts in dev * ignore .env * 🚑 fix constant warnings when onboarding with Ollama --------- Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
113 lines
2.8 KiB
TypeScript
113 lines
2.8 KiB
TypeScript
import * as dotenv from "dotenv";
|
|
|
|
import { CompletionOptions } from "../index.js";
|
|
import { BaseLLM } from "../llm/index.js";
|
|
import OpenAI from "../llm/llms/OpenAI.js";
|
|
|
|
// jest.setTimeout(100_000);
|
|
|
|
dotenv.config();
|
|
|
|
const COMPLETION_OPTIONS: Partial<CompletionOptions> = {
|
|
temperature: 0.5,
|
|
topP: 1,
|
|
topK: 40,
|
|
presencePenalty: 0,
|
|
frequencyPenalty: 0,
|
|
// stop: ["\n"],
|
|
// maxTokens: 5,
|
|
};
|
|
|
|
function testLLM(llm: BaseLLM) {
|
|
beforeAll(() => {
|
|
llm.completionOptions = { ...llm.completionOptions, ...COMPLETION_OPTIONS };
|
|
});
|
|
|
|
describe(llm.providerName, () => {
|
|
test("Stream Chat works", async () => {
|
|
let total = "";
|
|
for await (const chunk of llm.streamChat([
|
|
{ role: "user", content: "Hi" },
|
|
])) {
|
|
total += chunk.content;
|
|
}
|
|
|
|
expect(total.length).toBeGreaterThan(0);
|
|
console.log(total);
|
|
return;
|
|
});
|
|
|
|
test("Stream Complete works", async () => {
|
|
let total = "";
|
|
for await (const chunk of llm.streamComplete("Hi")) {
|
|
total += chunk;
|
|
}
|
|
|
|
expect(total.length).toBeGreaterThan(0);
|
|
console.log(total);
|
|
return;
|
|
});
|
|
|
|
test("Complete works", async () => {
|
|
const completion = await llm.complete("Hi");
|
|
|
|
expect(completion.length).toBeGreaterThan(0);
|
|
console.log(completion);
|
|
return;
|
|
});
|
|
});
|
|
}
|
|
|
|
describe("LLM", () => {
|
|
// testLLM(
|
|
// new FreeTrial({
|
|
// model: "gpt-3.5-turbo",
|
|
// }),
|
|
// );
|
|
// testLLM(
|
|
// new Anthropic({
|
|
// model: "claude-2",
|
|
// apiKey: process.env.ANTHROPIC_API_KEY,
|
|
// }),
|
|
// );
|
|
testLLM(
|
|
new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-3.5-turbo" }),
|
|
);
|
|
// TODO: Fix Replicate
|
|
// testLLM(
|
|
// new Replicate({
|
|
// apiKey: process.env.REPLICATE_API_KEY,
|
|
// model: "codellama-7b",
|
|
// })
|
|
// );
|
|
// testLLM(new LMStudio({ model: "codellama-7b" }));
|
|
// testLLM(new Ollama({ model: "codellama-7b" }));
|
|
// testLLM(
|
|
// new Together({
|
|
// apiKey: process.env.TOGETHER_API_KEY,
|
|
// model: "codellama-7b",
|
|
// })
|
|
// );
|
|
// testLLM(new LlamaCpp({ model: "deepseek-7b" }));
|
|
// testLLM(new Llamafile({ model: "mistral-7b" }));
|
|
// TODO: Test these
|
|
// testLLM(new TextGenWebUI({ model: "codellama-7b" }));
|
|
// testLLM(new HuggingFaceTGI({ model: "codellama-7b" }));
|
|
// testLLM(new HuggingFaceInferenceAPI({ model: "codellama-7b" }));
|
|
// testLLM(
|
|
// new Gemini({
|
|
// model: "gemini-pro",
|
|
// // model: "chat-bison-001",
|
|
// apiKey: process.env.GOOGLE_PALM_API_KEY,
|
|
// })
|
|
// );
|
|
// testLLM(
|
|
// new Gemini({ model: "gemini-pro", apiKey: process.env.GOOGLE_PALM_API_KEY })
|
|
// );
|
|
// testLLM(
|
|
// new Mistral({ apiKey: process.env.MISTRAL_API_KEY, model: "mistral-small" })
|
|
// );
|
|
// testLLM(
|
|
// new Flowise({ apiKey: process.env.FLOWISE_API_KEY, model: "gpt-3.5-turbo" })
|
|
// );
|
|
});
|