Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Apr 16, 2024
1 parent 70b16e8 commit 6724e42
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions packages/main/src/models/generative-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,27 @@ describe("GenerativeModel", () => {
expect(genModel.model).to.equal("tunedModels/my-model");
});
it("passes params through to generateContent", async () => {
const genModel = new GenerativeModel("apiKey", {
model: "my-model",
generationConfig: { temperature: 0 },
safetySettings: [
{
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
const genModel = new GenerativeModel(
"apiKey",
{
model: "my-model",
generationConfig: { temperature: 0 },
safetySettings: [
{
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
},
],
tools: [{ functionDeclarations: [{ name: "myfunc" }] }],
toolConfig: {
functionCallingConfig: { mode: FunctionCallingMode.NONE },
},
],
tools: [{ functionDeclarations: [{ name: "myfunc" }] }],
toolConfig: { functionCallingConfig: { mode: FunctionCallingMode.NONE } },
systemInstruction: { role: "system", parts: [{ text: "be friendly" }] },
}, {
apiVersion: 'v6'
});
systemInstruction: { role: "system", parts: [{ text: "be friendly" }] },
},
{
apiVersion: "v6",
},
);
expect(genModel.generationConfig?.temperature).to.equal(0);
expect(genModel.safetySettings?.length).to.equal(1);
expect(genModel.tools?.length).to.equal(1);
Expand Down Expand Up @@ -90,7 +96,7 @@ describe("GenerativeModel", () => {
);
}),
match((value) => {
return value.apiVersion === 'v6';
return value.apiVersion === "v6";
}),
);
restore();
Expand Down Expand Up @@ -156,11 +162,15 @@ describe("GenerativeModel", () => {
restore();
});
it("passes requestOptions through to countTokens", async () => {
const genModel = new GenerativeModel("apiKey", {
model: "my-model",
}, {
apiVersion: 'v2000'
});
const genModel = new GenerativeModel(
"apiKey",
{
model: "my-model",
},
{
apiVersion: "v2000",
},
);
const mockResponse = getMockResponse(
"unary-success-basic-reply-short.json",
);
Expand All @@ -176,7 +186,7 @@ describe("GenerativeModel", () => {
false,
match.any,
match((value) => {
return value.apiVersion === 'v2000';
return value.apiVersion === "v2000";
}),
);
restore();
Expand Down

0 comments on commit 6724e42

Please sign in to comment.