mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Enable tool-based message generation in chat-stream-provider
and add BasicValueTool
and WeatherTool
.
Updated dependencies to latest versions in `bun.lock`. Modified development script in `package.json` to include watch mode.
This commit is contained in:

committed by
Geoff Seemueller

parent
de968bcfbd
commit
06b6a68b9b
41
packages/ai/src/tools/basic.ts
Normal file
41
packages/ai/src/tools/basic.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
// tools/basicValue.ts
|
||||
export interface BasicValueResult {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export const BasicValueTool = {
|
||||
name: 'basicValue',
|
||||
type: 'function',
|
||||
description: 'Returns a basic value (timestamp-based) for testing',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {},
|
||||
required: [],
|
||||
},
|
||||
function: async (): Promise<BasicValueResult> => {
|
||||
// generate something obviously basic
|
||||
const basic = `tool-called-${Date.now()}`;
|
||||
console.log('[BasicValueTool] returning:', basic);
|
||||
return { value: basic };
|
||||
},
|
||||
};
|
||||
export const WeatherTool = {
|
||||
name: 'get_weather',
|
||||
type: 'function',
|
||||
description: 'Get current temperature for a given location.',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
location: {
|
||||
type: 'string',
|
||||
description: 'City and country e.g. Bogotá, Colombia',
|
||||
},
|
||||
},
|
||||
required: ['location'],
|
||||
additionalProperties: false,
|
||||
},
|
||||
function: async (params: { location: string }) => {
|
||||
console.log('[WeatherTool] Getting weather for:', params.location);
|
||||
return { temperature: '25°C' };
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user