@olane/o-core 0.4.4 → 0.6.1

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.
Files changed (76) hide show
  1. package/dist/src/core/core.node.d.ts +1 -1
  2. package/dist/src/core/core.node.d.ts.map +1 -1
  3. package/dist/src/core/core.node.js +7 -3
  4. package/dist/src/core/lib/o-address-resolution.d.ts.map +1 -1
  5. package/dist/src/core/lib/o-address-resolution.js +3 -4
  6. package/dist/src/core/lib/o-request.d.ts +2 -0
  7. package/dist/src/core/lib/o-request.d.ts.map +1 -1
  8. package/dist/src/core/lib/o-request.js +9 -0
  9. package/dist/src/core/lib/resolvers/anything.resolver.d.ts.map +1 -1
  10. package/dist/src/core/lib/resolvers/anything.resolver.js +2 -1
  11. package/dist/src/core/utils/network.utils.d.ts.map +1 -1
  12. package/dist/src/core/utils/network.utils.js +0 -1
  13. package/dist/src/error/tool.error.d.ts +2 -0
  14. package/dist/src/error/tool.error.d.ts.map +1 -1
  15. package/dist/src/error/tool.error.js +10 -0
  16. package/dist/src/index.d.ts +1 -0
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/index.js +1 -0
  19. package/dist/src/node/node.d.ts +4 -4
  20. package/dist/src/node/node.d.ts.map +1 -1
  21. package/dist/src/node/node.js +29 -32
  22. package/dist/src/plan/agent.plan.d.ts +2 -1
  23. package/dist/src/plan/agent.plan.d.ts.map +1 -1
  24. package/dist/src/plan/agent.plan.js +55 -33
  25. package/dist/src/plan/interfaces/configure.result.d.ts +6 -0
  26. package/dist/src/plan/interfaces/configure.result.d.ts.map +1 -0
  27. package/dist/src/plan/interfaces/configure.result.js +1 -0
  28. package/dist/src/plan/interfaces/handshake.result.d.ts +14 -0
  29. package/dist/src/plan/interfaces/handshake.result.d.ts.map +1 -0
  30. package/dist/src/plan/interfaces/handshake.result.js +1 -0
  31. package/dist/src/plan/interfaces/plan-config.interface.d.ts +3 -1
  32. package/dist/src/plan/interfaces/plan-config.interface.d.ts.map +1 -1
  33. package/dist/src/plan/interfaces/plan-type.enum.d.ts +2 -1
  34. package/dist/src/plan/interfaces/plan-type.enum.d.ts.map +1 -1
  35. package/dist/src/plan/interfaces/plan-type.enum.js +1 -0
  36. package/dist/src/plan/interfaces/plan.result.d.ts +4 -4
  37. package/dist/src/plan/interfaces/plan.result.d.ts.map +1 -1
  38. package/dist/src/plan/o-plan.d.ts +3 -1
  39. package/dist/src/plan/o-plan.d.ts.map +1 -1
  40. package/dist/src/plan/o-plan.js +52 -45
  41. package/dist/src/plan/prompts/agent.prompt.d.ts +1 -1
  42. package/dist/src/plan/prompts/agent.prompt.d.ts.map +1 -1
  43. package/dist/src/plan/prompts/agent.prompt.js +31 -14
  44. package/dist/src/plan/prompts/configure.prompt.d.ts +1 -1
  45. package/dist/src/plan/prompts/configure.prompt.d.ts.map +1 -1
  46. package/dist/src/plan/prompts/configure.prompt.js +34 -49
  47. package/dist/src/plan/prompts/custom.prompt.d.ts +1 -1
  48. package/dist/src/plan/prompts/custom.prompt.d.ts.map +1 -1
  49. package/dist/src/plan/prompts/custom.prompt.js +31 -6
  50. package/dist/src/plan/search/search.plan.d.ts.map +1 -1
  51. package/dist/src/plan/search/search.plan.js +15 -8
  52. package/dist/src/plan/use/use.plan.d.ts +3 -0
  53. package/dist/src/plan/use/use.plan.d.ts.map +1 -1
  54. package/dist/src/plan/use/use.plan.js +116 -38
  55. package/dist/src/utils/index.d.ts +3 -0
  56. package/dist/src/utils/index.d.ts.map +1 -0
  57. package/dist/src/utils/index.js +2 -0
  58. package/dist/src/utils/object.utils.d.ts +5 -0
  59. package/dist/src/utils/object.utils.d.ts.map +1 -0
  60. package/dist/src/utils/object.utils.js +23 -0
  61. package/dist/src/utils/regex.utils.d.ts +4 -0
  62. package/dist/src/utils/regex.utils.d.ts.map +1 -0
  63. package/dist/src/utils/regex.utils.js +13 -0
  64. package/package.json +6 -3
  65. package/dist/src/plan/configure/configure.plan.d.ts +0 -11
  66. package/dist/src/plan/configure/configure.plan.d.ts.map +0 -1
  67. package/dist/src/plan/configure/configure.plan.js +0 -15
  68. package/dist/src/plan/error/error.plan.d.ts +0 -11
  69. package/dist/src/plan/error/error.plan.d.ts.map +0 -1
  70. package/dist/src/plan/error/error.plan.js +0 -20
  71. package/dist/src/plan/prompts/error.prompt.d.ts +0 -2
  72. package/dist/src/plan/prompts/error.prompt.d.ts.map +0 -1
  73. package/dist/src/plan/prompts/error.prompt.js +0 -39
  74. package/dist/src/plan/prompts/search.prompt.d.ts +0 -2
  75. package/dist/src/plan/prompts/search.prompt.d.ts.map +0 -1
  76. package/dist/src/plan/prompts/search.prompt.js +0 -43
@@ -3,6 +3,11 @@ import { oPlan } from '../o-plan.js';
3
3
  import { oPlanType } from '../interfaces/plan-type.enum.js';
4
4
  import { oToolError } from '../../error/tool.error.js';
5
5
  import { oToolErrorCodes } from '../../error/enums/codes.error.js';
6
+ import { oPlanContext } from '../plan.context.js';
7
+ import { oAgentPlan } from '../agent.plan.js';
8
+ import { CONFIGURE_INSTRUCTIONS } from '../prompts/configure.prompt.js';
9
+ import { v4 as uuidv4 } from 'uuid';
10
+ import { ObjectUtils } from '../../utils/object.utils.js';
6
11
  /**
7
12
  * We know what tool we want to use, let's use it.
8
13
  */
@@ -19,53 +24,126 @@ export class oUsePlan extends oPlan {
19
24
  }
20
25
  return response;
21
26
  }
27
+ static hasOlaneAddress(value) {
28
+ return (!!value &&
29
+ typeof value === 'string' &&
30
+ !!value?.match(/o:\/\/.*(placeholder)+(?:\/[\w.-]+)+/g));
31
+ }
32
+ static extractAddresses(value) {
33
+ const matches = value.matchAll(/o:\/\/.*(placeholder)+(?:\/[\w.-]+)+/g);
34
+ return Array.from(matches, (match) => match[0]);
35
+ }
22
36
  async run() {
23
37
  this.logger.debug('Running...');
24
38
  if (!this.config.receiver) {
25
39
  throw new Error('Receiver is required');
26
40
  }
27
- // do handshake to get the method + parameters + dependencies
28
- const handshakeResponse = await this.node.use(this.config.receiver, {
29
- method: 'handshake',
30
- params: {
31
- intent: this.config.intent,
32
- // sequence: this.sequence.map((s) => {
33
- // return {
34
- // config: s.toCIDInput(),
35
- // result: s.result,
36
- // };
37
- // }),
38
- },
39
- });
40
- this.logger.debug('Handshake response: ', handshakeResponse);
41
- const data = handshakeResponse.result.data;
42
- this.logger.debug('Handshake data: ', data);
43
- const { handshake, error } = data;
44
- if (error) {
45
- return error;
46
- }
47
- if (!handshake) {
48
- throw new oToolError(oToolErrorCodes.TOOL_ERROR, 'Failed to configure the tool use');
41
+ try {
42
+ // do MCP handshake to get the method + parameters + dependencies
43
+ const handshakeResponse = await this.node.use(this.config.receiver, {
44
+ method: 'handshake',
45
+ params: {
46
+ intent: this.config.intent,
47
+ },
48
+ });
49
+ const { tools, methods, successes, failures } = handshakeResponse.result
50
+ .data;
51
+ const pc = new oAgentPlan({
52
+ ...this.config,
53
+ sequence: this.sequence,
54
+ intent: `This is a configure request, prioritize "Configure Request Instructions". You have already found the tool to resolve the user's intent: ${this.config.receiver}. Configure the request to use the tool with user intent: ${this.config.intent}`,
55
+ context: new oPlanContext([
56
+ `[Method Metadata Begin]\n${JSON.stringify(methods, null, 2)}\n[Method Metadata End]`,
57
+ `[Method Options Begin]\n${(tools || []).join(', ')}\n[Method Options End]`,
58
+ ]),
59
+ extraInstructions: CONFIGURE_INSTRUCTIONS,
60
+ parentId: this.id,
61
+ });
62
+ const result = await pc.execute();
63
+ this.addSequencePlan(pc);
64
+ this.logger.debug('Configure result: ', result);
65
+ const { configure, error: configureError } = result;
66
+ if (configureError) {
67
+ return {
68
+ error: configureError,
69
+ type: 'error',
70
+ };
71
+ }
72
+ if (!configure || !configure.task) {
73
+ throw new oToolError(oToolErrorCodes.TOOL_ERROR, 'Failed to configure the tool use');
74
+ }
75
+ const { task } = configure;
76
+ let params = task.payload?.params;
77
+ params = await ObjectUtils.allKeyValues(params, async (key, val) => {
78
+ let value = val;
79
+ if (!oUsePlan.hasOlaneAddress(value)) {
80
+ return value;
81
+ }
82
+ // extract the addresses & process them if LFS is needed
83
+ this.logger.debug('Has olane address: ', value);
84
+ const addresses = oUsePlan.extractAddresses(value);
85
+ for (const address of addresses) {
86
+ const largeDataResponse = await this.node.use(new oAddress(address));
87
+ this.logger.debug('Large data response: ', largeDataResponse.result.data);
88
+ value = value.replace(address, largeDataResponse.result.data?.value || 'unknown value');
89
+ this.logger.debug('Updated the value with LFS value: ', value);
90
+ }
91
+ return value;
92
+ });
93
+ const response = await this.node.use(this.config.receiver, {
94
+ method: task.payload?.method,
95
+ params: params,
96
+ });
97
+ return {
98
+ result: `Tool input: ${JSON.stringify(task || {}, null, 2)}\nTool output: ${JSON.stringify(response.result, null, 2)}`,
99
+ type: 'result',
100
+ };
49
101
  }
50
- const response = await this.node.use(this.config.receiver, {
51
- method: handshake.payload?.method,
52
- params: handshake.payload?.params,
53
- });
54
- this.logger.debug('Use response: ', response);
55
- // check for error
56
- if (response.result.error) {
102
+ catch (error) {
103
+ this.logger.error('Error executing use plan: ', error);
104
+ if (error instanceof oToolError) {
105
+ return {
106
+ error: error.toString(),
107
+ type: 'error',
108
+ };
109
+ }
57
110
  return {
58
- error: {
59
- ...response.result.error,
60
- // methodMetadata: data.methodMetadata,
61
- // methods: data.methods,
62
- },
111
+ error: error?.message || error || 'Unknown error',
63
112
  type: 'error',
64
113
  };
65
114
  }
66
- return {
67
- result: response.result,
68
- type: 'result',
69
- };
115
+ }
116
+ async postflight(result) {
117
+ // if the response is larger than 10,000 characters, then put it in an address
118
+ const THRESHOLD_DATA_SIZE = 1000;
119
+ if (this.config?.receiver &&
120
+ this.config.receiver.toString().indexOf('placeholder') === -1 &&
121
+ JSON.stringify(result).length > THRESHOLD_DATA_SIZE) {
122
+ let data = result.result;
123
+ data = await ObjectUtils.allKeyValues(data, async (key, val) => {
124
+ const value = val;
125
+ if (value &&
126
+ typeof value === 'string' &&
127
+ value.length > THRESHOLD_DATA_SIZE) {
128
+ const addressKey = uuidv4();
129
+ this.logger.debug('Storing large data in address: ', value);
130
+ const largeDataResponse = await this.node.use(new oAddress('o://placeholder'), {
131
+ method: 'put',
132
+ params: {
133
+ key: addressKey,
134
+ value: value,
135
+ intent: this.config.intent,
136
+ },
137
+ });
138
+ const { instructions } = largeDataResponse.result.data;
139
+ return instructions;
140
+ }
141
+ });
142
+ // update the response data
143
+ result.result = data;
144
+ }
145
+ this.result = result;
146
+ await super.postflight(result);
147
+ return result;
70
148
  }
71
149
  }
@@ -0,0 +1,3 @@
1
+ export * from './object.utils.js';
2
+ export * from './regex.utils.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './object.utils.js';
2
+ export * from './regex.utils.js';
@@ -0,0 +1,5 @@
1
+ export declare class ObjectUtils {
2
+ static isObject(obj: any): boolean;
3
+ static allKeyValues(obj: any, callback: (key: string, value: any) => Promise<any>): Promise<any>;
4
+ }
5
+ //# sourceMappingURL=object.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/object.utils.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;WAIrB,YAAY,CACvB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAClD,OAAO,CAAC,GAAG,CAAC;CAkBhB"}
@@ -0,0 +1,23 @@
1
+ export class ObjectUtils {
2
+ static isObject(obj) {
3
+ return obj !== null && typeof obj === 'object';
4
+ }
5
+ static async allKeyValues(obj, callback) {
6
+ if (!ObjectUtils.isObject(obj)) {
7
+ return obj;
8
+ }
9
+ for (const key in obj) {
10
+ let value = obj[key];
11
+ // iterate over the object if not a primitive
12
+ if (ObjectUtils.isObject(value)) {
13
+ value = await ObjectUtils.allKeyValues(value, callback);
14
+ }
15
+ else {
16
+ value = await callback(key, value);
17
+ }
18
+ // update the object
19
+ obj[key] = value;
20
+ }
21
+ return obj;
22
+ }
23
+ }
@@ -0,0 +1,4 @@
1
+ export declare class RegexUtils {
2
+ static extractResultFromAI(message: string): any;
3
+ }
4
+ //# sourceMappingURL=regex.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/regex.utils.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG;CAajD"}
@@ -0,0 +1,13 @@
1
+ export class RegexUtils {
2
+ static extractResultFromAI(message) {
3
+ // handle 4 levels of nested JSON
4
+ const match = message.match(/\{.+\}/s);
5
+ const json = match ? match[0] : null;
6
+ if (!json) {
7
+ throw new Error('AI failed to return a valid JSON object');
8
+ }
9
+ // process the result and react
10
+ const planResult = JSON.parse(json);
11
+ return planResult;
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-core",
3
- "version": "0.4.4",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "test": "aegir test",
20
20
  "test:node": "aegir test -t node",
21
21
  "test:browser": "aegir test -t browser",
22
+ "deep:clean": "rm -rf node_modules && rm package-lock.json",
22
23
  "dev": "DEBUG=o-protocol:* npx tsx src/tests/index.ts",
23
24
  "build": "tsc",
24
25
  "start:prod": "node dist/index.js",
@@ -35,6 +36,8 @@
35
36
  "devDependencies": {
36
37
  "@eslint/eslintrc": "^3.3.1",
37
38
  "@eslint/js": "^9.29.0",
39
+ "@olane/o-config": "file:packages/o-config",
40
+ "@olane/o-protocol": "file:packages/o-protocol",
38
41
  "@tsconfig/node20": "^20.1.6",
39
42
  "@types/jest": "^30.0.0",
40
43
  "@types/uuid": "^10.0.0",
@@ -54,8 +57,8 @@
54
57
  "typescript": "^5.8.3"
55
58
  },
56
59
  "peerDependencies": {
57
- "@olane/o-config": "^0.4.3",
58
- "@olane/o-protocol": "^0.4.3"
60
+ "@olane/o-config": "^0.6.0",
61
+ "@olane/o-protocol": "^0.6.0"
59
62
  },
60
63
  "dependencies": {
61
64
  "chalk": "^5.4.1",
@@ -1,11 +0,0 @@
1
- import { oPlan } from '../o-plan.js';
2
- import { oPlanType } from '../interfaces/plan-type.enum.js';
3
- import { oPlanConfig } from '../interfaces/plan-config.interface.js';
4
- /**
5
- * We know what tool we want to use, let's configure it.
6
- */
7
- export declare class oConfigurePlan extends oPlan {
8
- constructor(config: oPlanConfig);
9
- type(): oPlanType;
10
- }
11
- //# sourceMappingURL=configure.plan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configure.plan.d.ts","sourceRoot":"","sources":["../../../../src/plan/configure/configure.plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,MAAM,EAAE,WAAW;IAK/B,IAAI;CAGL"}
@@ -1,15 +0,0 @@
1
- import { oPlan } from '../o-plan.js';
2
- import { oPlanType } from '../interfaces/plan-type.enum.js';
3
- import { CONFIGURE_PROMPT } from '../prompts/configure.prompt.js';
4
- /**
5
- * We know what tool we want to use, let's configure it.
6
- */
7
- export class oConfigurePlan extends oPlan {
8
- constructor(config) {
9
- super(config);
10
- this.config.promptFunction = CONFIGURE_PROMPT;
11
- }
12
- type() {
13
- return oPlanType.CONFIGURE;
14
- }
15
- }
@@ -1,11 +0,0 @@
1
- import { oPlanConfig } from '../interfaces/plan-config.interface.js';
2
- import { oPlanResult } from '../interfaces/plan.result.js';
3
- import { oPlan } from '../o-plan.js';
4
- export declare class oErrorPlan extends oPlan {
5
- private error;
6
- constructor(config: oPlanConfig & {
7
- error: any;
8
- });
9
- run(): Promise<oPlanResult>;
10
- }
11
- //# sourceMappingURL=error.plan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.plan.d.ts","sourceRoot":"","sources":["../../../../src/plan/error/error.plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,qBAAa,UAAW,SAAQ,KAAK;IACnC,OAAO,CAAC,KAAK,CAAM;gBACP,MAAM,EAAE,WAAW,GAAG;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE;IAK1C,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;CAalC"}
@@ -1,20 +0,0 @@
1
- import { oAddress } from '../../core/o-address.js';
2
- import { oPlan } from '../o-plan.js';
3
- import { ERROR_PROMPT } from '../prompts/error.prompt.js';
4
- export class oErrorPlan extends oPlan {
5
- constructor(config) {
6
- super(config);
7
- this.error = config.error;
8
- }
9
- async run() {
10
- const prompt = ERROR_PROMPT(this.error, this.agentHistory);
11
- this.logger.debug('Error prompt: ', prompt);
12
- const response = await this.node.use(new oAddress('o://intelligence'), {
13
- method: 'prompt',
14
- params: {
15
- prompt: prompt,
16
- },
17
- });
18
- return response.result.data;
19
- }
20
- }
@@ -1,2 +0,0 @@
1
- export declare const ERROR_PROMPT: (error: any, agentHistory: string) => string;
2
- //# sourceMappingURL=error.prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.prompt.d.ts","sourceRoot":"","sources":["../../../../src/plan/prompts/error.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG,EAAE,cAAc,MAAM,WAsC5D,CAAC"}
@@ -1,39 +0,0 @@
1
- export const ERROR_PROMPT = (error, agentHistory) => `
2
- You are an AI agent that helps the user fix an error.
3
-
4
- General Information:
5
- - You have access to tools that are interconnected through a p2p network.
6
- - You have access to a knowledge vector database tool that can provide information about tools and general knowledge.
7
- - Network addresses are used to access tools.
8
- - Other networks may be accessible through the network address resolution system.
9
- - Context from searching across networks is added to the "Additional Context" section.
10
- - The state of solving the user's intent is logged in the "Agent State" section.
11
-
12
- Error: ${JSON.stringify(error, null, 2)}
13
-
14
- Rules:
15
- 1. Do not explain the reasoning process, just return the output.
16
- 2. Do not include \`\`\`json or \`\`\` in your output.
17
-
18
- Steps:
19
- 1. Review the error and determine the cause.
20
- 2. Check the agentic state history to see if there was a better choice that could have been made to prevent this error.
21
- 3. Review the method options to see if there was a better method that could have been used to prevent this error.
22
- 4. Review the method metadata to see if the error is due to a missing method or parameter.
23
- 5. If you can fix the error, provide a solution.
24
- 6. If you cannot fix the error, create a human readable explanation on how to solve the error.
25
- 5. The explanation should summarize the intent and explain why it failed concisely.
26
-
27
- Error Output Format:
28
- {
29
- "error": {
30
- "message": string,
31
- "solution": string,
32
- "explanation": string,
33
- },
34
- "type": "error",
35
- }
36
-
37
- [Agentic State]
38
- ${agentHistory}
39
- `;
@@ -1,2 +0,0 @@
1
- export declare const SEARCH_PROMPT: (intent: string, context: string) => string;
2
- //# sourceMappingURL=search.prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.prompt.d.ts","sourceRoot":"","sources":["../../../../src/plan/prompts/search.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,WA0C5D,CAAC"}
@@ -1,43 +0,0 @@
1
- export const SEARCH_PROMPT = (intent, context) => `
2
- You are a helpful assistant that searches for unknown entities in the user's input or returns a tool address that helps complete the user's task.
3
-
4
- All entities are hosted within a network of p2p nodes and are tools, data, or other items.
5
- The p2p nodes and their contained data are accessible via the network address resolution system.
6
-
7
- All entity data is stored within a vector database that can be queried for more information.
8
-
9
- User Input: ${intent}
10
-
11
- Rules:
12
- 1. Do not explain the reasoning process, just return the output.
13
- 2. Your output should be a search query or the tool address to use to answer the user's input.
14
- 3. Do not include \`\`\`json or \`\`\` in your output.
15
-
16
- Steps:
17
- 1. If you know a tool that can help with the user's input, return it in the format of a task output.
18
- 2. Create a list of unknown entities mentioned in the user's input.
19
- 3. Generate a vector db query for each unknown entity.
20
- 4. Do not return a tool address unless you have seen it in the context.
21
-
22
- Task Output Format:
23
- {
24
- "task": {
25
- "address": string,
26
- },
27
- "type": "task",
28
- }
29
-
30
- Search Output Format:
31
- {
32
- "queries": [
33
- {
34
- "query": string,
35
- "explanation": string,
36
- }
37
- ],
38
- "type": "search",
39
- }
40
-
41
- Additional Context: ${context}
42
-
43
- `;