@indexnetwork/protocol 1.12.6-rc.172.1 → 1.13.0-rc.174.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.
@@ -1,108 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { HumanMessage, SystemMessage } from "@langchain/core/messages";
11
- import { tool } from "@langchain/core/tools";
12
- import { z } from "zod/v4";
13
- import { protocolLogger } from "../shared/observability/protocol.logger.js";
14
- import { Timed } from "../shared/observability/performance.js";
15
- import { createModel } from "../shared/agent/model.config.js";
16
- const logger = protocolLogger("HyDEGenerator");
17
- const model = createModel("profileHydeGenerator");
18
- const systemPrompt = `
19
- You are a Profile Profiler.
20
- Given a user's profile, imagine a **Hypothetical User Profile** person that would be the best match for the user to accomplish their goals.
21
-
22
- Imagine this ideal candidate actually exists. Write a profile for THEM.
23
- Your output will be used to vector-search a database of real user profiles.
24
-
25
- Structure your response as a natural language Bio/Narrative written in the **Third Person**.
26
-
27
- The description should include:
28
- 1. **Context**: Who they are (role, background).
29
- 2. **Skills/lnterests**: What they are good at that complements the user.
30
- 3. **Goals**: What they are trying to achieve that aligns with the user.
31
-
32
- **CRITICAL INSTRUCTION - COMPLEMENTARY MATCHING:**
33
- - Do NOT just look for "similar" people. Look for people who provide what the user NEEDS (Supply/Demand).
34
- - If the user is a **Founder**, describe an **Investor** or **VC**.
35
- - If the user is a **Learner**, describe a **Mentor** or **Expert**.
36
- - If the user is a **Builder**, describe a **Collaborator** or **Co-founder**.
37
-
38
- Do NOT describe the Source User. Describe the TARGET Match.
39
- Do NOT invent a name for the candidate. Refer to them as "The candidate", "They", or "This individual".
40
- Do NOT include locations.
41
-
42
- PRIVACY: Never include email addresses, phone numbers, physical addresses, government IDs, or other contact identifiers in bio or narrative — even if they appear in the source profile.
43
- `;
44
- const responseFormat = z.object({
45
- identity: z.object({
46
- bio: z.string().describe("Professional summary only; no email, phone, physical address, government ID, or other contact identifiers"),
47
- }),
48
- narrative: z.object({
49
- context: z.string().describe("Rich narrative without email, phone, physical address, government ID, or other contact identifiers"),
50
- }),
51
- attributes: z.object({
52
- interests: z.array(z.string()).describe("Inferred or explicit interests"),
53
- skills: z.array(z.string()).describe("Professional skills"),
54
- }),
55
- });
56
- export class HydeGenerator {
57
- constructor() {
58
- this.model = model.withStructuredOutput(responseFormat, {
59
- name: "hyde_generator"
60
- });
61
- }
62
- toString(description) {
63
- const textToEmbed = [
64
- '# Identity',
65
- '## Bio', description.identity.bio,
66
- '# Narrative',
67
- '## Context', description.narrative.context,
68
- '# Attributes',
69
- '## Interests', description.attributes.interests.join(', '),
70
- '## Skills', description.attributes.skills.join(', ')
71
- ].join('\n');
72
- return textToEmbed;
73
- }
74
- async invoke(input) {
75
- logger.verbose("Received input", { inputLength: input?.length });
76
- const messages = [
77
- new SystemMessage(systemPrompt),
78
- new HumanMessage(`Here is the profile for the HyDE Generation:\n${input}`)
79
- ];
80
- const result = await this.model.invoke(messages);
81
- const output = responseFormat.parse(result);
82
- const textToEmbed = this.toString(output);
83
- logger.verbose("Generated HyDE profile", {
84
- skillsCount: output.attributes.skills.length,
85
- interestsCount: output.attributes.interests.length
86
- });
87
- return { output, textToEmbed };
88
- }
89
- static asTool() {
90
- return tool(async (args) => {
91
- const hydeGenerator = new HydeGenerator();
92
- return await hydeGenerator.invoke(args.input);
93
- }, {
94
- name: 'hydeGenerator',
95
- description: 'HyDE Generator',
96
- schema: z.object({
97
- input: z.string().describe('The profile to generate a HyDE for'),
98
- })
99
- });
100
- }
101
- }
102
- __decorate([
103
- Timed(),
104
- __metadata("design:type", Function),
105
- __metadata("design:paramtypes", [String]),
106
- __metadata("design:returntype", Promise)
107
- ], HydeGenerator.prototype, "invoke", null);
108
- //# sourceMappingURL=profile.hyde.generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.hyde.generator.js","sourceRoot":"","sources":["../../src/profile/profile.hyde.generator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,MAAM,MAAM,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE/C,MAAM,KAAK,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAElD,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpB,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2GAA2G,CAAC;KACtI,CAAC;IACF,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oGAAoG,CAAC;KACnI,CAAC;IACF,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,SAAS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