Skip to content

Commit

Permalink
feat: tools 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
JongMany committed Oct 21, 2024
1 parent 32bc56d commit c89677d
Showing 1 changed file with 111 additions and 18 deletions.
129 changes: 111 additions & 18 deletions src/constants/function_calling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,135 @@ export interface UserProfileParams {
conversation_context?: string[];
}

// export const saveUserProfileTools = {
// name: 'saveUserProfile',
// description:
// 'Saves all relevant user profile data, preferences, and conversation facts to the database',
// parameters: {
// type: 'object',
// properties: {
// userId: {
// type: 'string',
// description: 'The unique ID of the user',
// },
// name: {
// type: 'string',
// description: 'The name of the user',
// },
// age: {
// type: 'integer',
// description: "The user's age",
// },
// location: {
// type: 'string',
// description: "The user's location, city or country",
// },
// preferences: {
// type: 'object',
// description: "The user's preferences",
// properties: {
// favorite_color: {
// type: 'string',
// description: "The user's favorite color",
// },
// favorite_food: {
// type: 'string',
// description: "The user's favorite food",
// },
// preferred_language: {
// type: 'string',
// description: "The user's preferred language",
// },
// hobbies: {
// type: 'array',
// items: {
// type: 'string',
// },
// description: "The user's hobbies or interests",
// },
// },
// },
// recent_activities: {
// type: 'array',
// items: {
// type: 'string',
// },
// description: 'Recent actions the user has taken or mentioned',
// },
// device_info: {
// type: 'object',
// description: "Information about the user's device",
// properties: {
// device_type: {
// type: 'string',
// description:
// 'The type of device the user is using (e.g., mobile, desktop)',
// },
// os: {
// type: 'string',
// description: "The operating system of the user's device",
// },
// },
// },
// conversation_context: {
// type: 'array',
// items: {
// type: 'string',
// },
// description: 'Relevant facts gathered during the conversation',
// },
// },
// // required: ['userId', 'name'],
// },
// };

export const saveUserProfileTools = {
name: 'saveUserProfile',
description:
'Saves all relevant user profile data, preferences, and conversation facts to the database',
'Saves user profile data, preferences, and conversation facts into the database. This includes user device information, recent activities, and more.',
parameters: {
type: 'object',
properties: {
userId: {
type: 'string',
description: 'The unique ID of the user',
description: 'The unique ID of the user. This is a required field.',
},
name: {
type: 'string',
description: 'The name of the user',
description: 'The name of the user. This is a required field.',
},
age: {
type: 'integer',
description: "The user's age",
description: "The user's age (optional).",
minimum: 0, // Ensure age is a non-negative value
},
location: {
type: 'string',
description: "The user's location, city or country",
description:
"The user's location (optional). Could be city, country, etc.",
},
preferences: {
type: 'object',
description: "The user's preferences",
description: "The user's preferences, such as favorite things.",
properties: {
favorite_color: {
type: 'string',
description: "The user's favorite color",
description: "The user's favorite color.",
},
favorite_food: {
type: 'string',
description: "The user's favorite food",
description: "The user's favorite food.",
},
preferred_language: {
type: 'string',
description: "The user's preferred language",
description: "The user's preferred language for communication.",
},
hobbies: {
type: 'array',
items: {
type: 'string',
},
description: "The user's hobbies or interests",
description: "The user's hobbies or interests (optional).",
},
},
},
Expand All @@ -70,20 +154,29 @@ export const saveUserProfileTools = {
items: {
type: 'string',
},
description: 'Recent actions the user has taken or mentioned',
description:
'A list of recent actions or activities the user has taken (optional).',
},
device_info: {
type: 'object',
description: "Information about the user's device",
description: "Information about the user's device (optional).",
properties: {
device_type: {
type: 'string',
description:
'The type of device the user is using (e.g., mobile, desktop)',
description: 'The type of device (e.g., mobile, desktop, tablet).',
},
os: {
type: 'string',
description: "The operating system of the user's device",
description:
"The operating system running on the user's device (e.g., iOS, Android, Windows).",
},
browser: {
type: 'string',
description: 'The browser used by the user (e.g., Chrome, Safari).',
},
screen_resolution: {
type: 'string',
description: "The user's screen resolution (e.g., 1920x1080).",
},
},
},
Expand All @@ -92,13 +185,13 @@ export const saveUserProfileTools = {
items: {
type: 'string',
},
description: 'Relevant facts gathered during the conversation',
description:
'Relevant facts and contexts gathered from the current conversation.',
},
},
// required: ['userId', 'name'],
required: ['userId', 'name'], // Making userId and name required
},
};

export function saveUserProfile(params) {
console.log(params);
return JSON.stringify(params);
Expand Down

0 comments on commit c89677d

Please sign in to comment.