@surph_ai/cli 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ToolHandler } from '@surph_ai/sdk';
|
|
2
|
-
import { surph } from '@surph_ai/sdk';
|
|
3
|
-
|
|
4
|
-
// your custom tool args goes here
|
|
5
|
-
type ToolArgs = {
|
|
6
|
-
preferences: string[]
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const handler: ToolHandler<ToolArgs> = async ({ args, user, contexts = null, board = null }: Record<string, any>) => {
|
|
10
|
-
try {
|
|
11
|
-
if (!args) {
|
|
12
|
-
throw new Error('Args required.')
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (!contexts) {
|
|
16
|
-
throw new Error('Contexts required.')
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { preferences } = args; // string[]
|
|
20
|
-
const searchQuery = preferences.join(', ')
|
|
21
|
-
|
|
22
|
-
const context = contexts[0]
|
|
23
|
-
const searchResults = await surph.search(searchQuery, context)
|
|
24
|
-
|
|
25
|
-
const promptResponse = await surph.prompt({
|
|
26
|
-
instructions: `searchResults is a JSON array data feed of events and announcements. Your job is to sort each item into one of three categories: offering free food, free event, or free giveaway (such as raffles, prizes, etc.).`,
|
|
27
|
-
prompt: `Given this list of items, separate them into free food, free event, or free giveaway:\n\n${JSON.stringify(searchResults)}`,
|
|
28
|
-
output: {
|
|
29
|
-
name: 'deal_search_results',
|
|
30
|
-
description: 'The deal search results',
|
|
31
|
-
fields: [
|
|
32
|
-
{ name: 'food', type: 'array', description: 'a list of events and announcements with free food.' },
|
|
33
|
-
{ name: 'event', type: 'array', description: 'a list of events that are free to attend.' },
|
|
34
|
-
{ name: 'items', type: 'array', description: 'a list of events and announcements with free items.' }
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return promptResponse
|
|
40
|
-
} catch (error) {
|
|
41
|
-
throw error
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default handler;
|
|
46
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"deal-finder-q9je7jou": {
|
|
3
|
-
"name": "deal-finder",
|
|
4
|
-
"slug": "deal-finder-q9je7jou",
|
|
5
|
-
"type": "custom",
|
|
6
|
-
"description": "Search the user's active Surph context for local deals, discounts, promotions, specials, sales, and related opportunities across food, drinks, restaurants, shops, events, entertainment, and other businesses or venues covered by the context. Use whenever the user asks to find, compare, filter, or recommend current or upcoming local deals—including requests for happy hours, meal specials, event discounts, retail sales, coupons, or promotions. Prefer this instead of webSearch when the requested local businesses, venues, events, or listings are represented in the active Surph context.",
|
|
7
|
-
"parameters": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"preferences": {
|
|
11
|
-
"type": "array",
|
|
12
|
-
"description": "Optional free-form preferences, categories, constraints, or deal criteria to prioritize, such as food, drinks, events, retail sales, happy hour, nearby neighborhoods, budget, dates, or specific businesses.",
|
|
13
|
-
"items": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"required": []
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|