mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 23:02:02 +03:00
chore: Fix failing test.
This commit is contained in:
@@ -9,6 +9,13 @@ const asRecord = (value: unknown): Record<string, unknown> => {
|
|||||||
return value as Record<string, unknown>;
|
return value as Record<string, unknown>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getFirstToolParameters = (
|
||||||
|
converted: ReturnType<typeof convertTools>,
|
||||||
|
): Record<string, unknown> => {
|
||||||
|
const functionDeclaration = asRecord(converted?.[0]?.functionDeclarations?.[0]);
|
||||||
|
return asRecord(functionDeclaration.parametersJsonSchema ?? functionDeclaration.parameters);
|
||||||
|
};
|
||||||
|
|
||||||
const makeModel = (id: string): Model<"google-generative-ai"> =>
|
const makeModel = (id: string): Model<"google-generative-ai"> =>
|
||||||
({
|
({
|
||||||
id,
|
id,
|
||||||
@@ -53,7 +60,7 @@ describe("google-shared convertTools", () => {
|
|||||||
] as unknown as Tool[];
|
] as unknown as Tool[];
|
||||||
|
|
||||||
const converted = convertTools(tools);
|
const converted = convertTools(tools);
|
||||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
const params = getFirstToolParameters(converted);
|
||||||
|
|
||||||
expect(params.type).toBeUndefined();
|
expect(params.type).toBeUndefined();
|
||||||
expect(params.properties).toBeDefined();
|
expect(params.properties).toBeDefined();
|
||||||
@@ -93,7 +100,7 @@ describe("google-shared convertTools", () => {
|
|||||||
] as unknown as Tool[];
|
] as unknown as Tool[];
|
||||||
|
|
||||||
const converted = convertTools(tools);
|
const converted = convertTools(tools);
|
||||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
const params = getFirstToolParameters(converted);
|
||||||
const properties = asRecord(params.properties);
|
const properties = asRecord(params.properties);
|
||||||
const mode = asRecord(properties.mode);
|
const mode = asRecord(properties.mode);
|
||||||
const options = asRecord(properties.options);
|
const options = asRecord(properties.options);
|
||||||
@@ -134,7 +141,7 @@ describe("google-shared convertTools", () => {
|
|||||||
] as unknown as Tool[];
|
] as unknown as Tool[];
|
||||||
|
|
||||||
const converted = convertTools(tools);
|
const converted = convertTools(tools);
|
||||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
const params = getFirstToolParameters(converted);
|
||||||
const config = asRecord(asRecord(params.properties).config);
|
const config = asRecord(asRecord(params.properties).config);
|
||||||
const configProps = asRecord(config.properties);
|
const configProps = asRecord(config.properties);
|
||||||
const retries = asRecord(configProps.retries);
|
const retries = asRecord(configProps.retries);
|
||||||
|
|||||||
Reference in New Issue
Block a user