@dxos/assistant 0.8.4-staging.60fe92afc8 → 0.9.1-main.c7dcc2e112

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 (30) hide show
  1. package/dist/lib/neutral/extraction/index.mjs +108 -119
  2. package/dist/lib/neutral/extraction/index.mjs.map +4 -4
  3. package/dist/lib/neutral/index.mjs +17 -13
  4. package/dist/lib/neutral/index.mjs.map +4 -4
  5. package/dist/lib/neutral/meta.json +1 -1
  6. package/dist/types/src/extraction/extraction-llm-function/index.d.ts +2 -0
  7. package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +1 -0
  8. package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts +227 -0
  9. package/dist/types/src/extraction/extraction-llm-function/proper-noun-extraction.d.ts.map +1 -0
  10. package/dist/types/src/extraction/index.d.ts +1 -1
  11. package/dist/types/src/extraction/index.d.ts.map +1 -1
  12. package/dist/types/src/extraction/quotes.d.ts +8 -1
  13. package/dist/types/src/extraction/quotes.d.ts.map +1 -1
  14. package/dist/types/src/request/AiRequest.d.ts +6 -0
  15. package/dist/types/src/request/AiRequest.d.ts.map +1 -1
  16. package/dist/types/src/session/AiSession.d.ts +6 -0
  17. package/dist/types/src/session/AiSession.d.ts.map +1 -1
  18. package/dist/types/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +21 -21
  20. package/src/extraction/extraction-llm-function/index.ts +5 -0
  21. package/src/extraction/extraction-llm-function/proper-noun-extraction.ts +78 -0
  22. package/src/extraction/index.ts +1 -1
  23. package/src/extraction/quotes.test.ts +67 -2
  24. package/src/extraction/quotes.ts +47 -13
  25. package/src/request/AiRequest.ts +10 -0
  26. package/src/session/AiSession.ts +8 -0
  27. package/dist/types/src/extraction/extraction.d.ts +0 -1677
  28. package/dist/types/src/extraction/extraction.d.ts.map +0 -1
  29. package/src/extraction/extraction-llm-function/transcription-instructions.tpl +0 -28
  30. package/src/extraction/extraction.ts +0 -105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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAShC,CAAC;AAEH;;GAEG;AAEH,eAAO,MAAM,wBAAwB,WAAkB,6BAA6B,KAAG,OAAO,CAAC,gBAAgB,CAqB9G,CAAC"}
@@ -1,28 +0,0 @@
1
- You are an AI assistant specialized in processing and enhancing transcripts with contextual information.
2
- Your task is to analyze a given transcript and extract references to the context objects.
3
-
4
- The context and transcript are provided in the user message in `context` and `transcript` XML tags.
5
-
6
- Here are your instructions:
7
-
8
- 1. Read the transcript and context information provided above.
9
-
10
- 2. Process each segment of the transcript separately.
11
-
12
- 3. For each segment:
13
- a. Analyze the content and identify relevant information from the context.
14
- b. Extract a number of references to the context objects that are mentioned in the segment.
15
- c. Output the references in the format `{ "quote": "earnings report", "id": "01JT0JP9AX0XKGZX4MV4B69VT6" }`.
16
- d. If there are no references, just output an empty array.
17
-
18
- 4. Maintain the exact order and structure of the original transcript segments.
19
-
20
- Output Format:
21
- You have been provided with a tool that specifies output format
22
-
23
- Remember:
24
- - Only quote the text that is in the transcript.
25
- - Analyze each segment carefully before processing it.
26
- - Only reference objects that appear in the context and exactly by their id, If the object is not in the context, do not insert a reference.
27
-
28
- Now, process the transcript and context provided below according to these instructions.
@@ -1,105 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Schema from 'effect/Schema';
6
-
7
- import { Operation } from '@dxos/compute';
8
- import { Obj, Type } from '@dxos/echo';
9
- import { DXN } from '@dxos/keys';
10
- import { log } from '@dxos/log';
11
- import { Message } from '@dxos/types';
12
-
13
- export const ExtractionInput = Schema.Struct({
14
- message: Type.getSchema(Message.Message),
15
- objects: Schema.optional(Schema.Array(Obj.Unknown)),
16
- options: Schema.optional(
17
- Schema.Struct({
18
- timeout: Schema.optional(Schema.Number),
19
- fallbackToRaw: Schema.optional(Schema.Boolean),
20
- }),
21
- ),
22
- });
23
- export type ExtractionInput = Schema.Schema.Type<typeof ExtractionInput>;
24
- export const ExtractionOutput = Schema.Struct({
25
- message: Type.getSchema(Message.Message),
26
- timeElapsed: Schema.Number,
27
- });
28
- export type ExtractionOutput = Schema.Schema.Type<typeof ExtractionOutput>;
29
- export type ProcessTranscriptMessageProps = {
30
- input: ExtractionInput;
31
- function: Operation.Definition<ExtractionInput, ExtractionOutput>;
32
-
33
- options?: {
34
- /**
35
- * Timeout for the entity extraction.
36
- */
37
- timeout?: number;
38
-
39
- /**
40
- * Fallback to raw text if the entity extraction fails.
41
- * Otherwise the function will throw an error.
42
- * @default false
43
- */
44
- fallbackToRaw?: boolean;
45
- };
46
- };
47
-
48
- export type ExtractionFunction = Operation.Definition<ExtractionInput, ExtractionOutput>;
49
-
50
- /**
51
- * Placeholder for Anthropic-based entity extraction.
52
- * Implementation is currently disabled pending restoration of extraction logic.
53
- */
54
- export const extractionAnthropicFunction = Operation.make({
55
- meta: {
56
- key: DXN.make('org.dxos.function.extraction.anthropic'),
57
- name: 'Entity Extraction (Anthropic)',
58
- description: 'Extract entities from transcript using Anthropic LLM.',
59
- icon: 'ph--text-t--regular',
60
- },
61
- input: ExtractionInput,
62
- output: ExtractionOutput,
63
- });
64
-
65
- /**
66
- * Placeholder for NER-based entity extraction.
67
- * Implementation is currently disabled pending restoration of extraction logic.
68
- */
69
- export const extractionNerFunction = Operation.make({
70
- meta: {
71
- key: DXN.make('org.dxos.function.extraction.ner'),
72
- name: 'Entity Extraction (NER)',
73
- description: 'Extract entities from transcript using Named Entity Recognition.',
74
- icon: 'ph--text-t--regular',
75
- },
76
- input: ExtractionInput,
77
- output: ExtractionOutput,
78
- });
79
-
80
- /**
81
- * Extract entities from the transcript message and add them to the message.
82
- */
83
- // TODO(dmaretskyi): Move context to a vector search index.
84
- export const processTranscriptMessage = async (params: ProcessTranscriptMessageProps): Promise<ExtractionOutput> => {
85
- try {
86
- if (params.options?.timeout && params.options.timeout > 0) {
87
- // return await asyncTimeout(params.executor.invoke(params.function, params.input), params.options.timeout);
88
- } else {
89
- // return await params.executor.invoke(params.function, params.input);
90
- }
91
- } catch (error) {
92
- if (params.options?.fallbackToRaw) {
93
- log.warn('failed to process message, falling back to raw text', { error });
94
- return {
95
- message: params.input.message,
96
- timeElapsed: 0,
97
- };
98
- } else {
99
- throw error;
100
- }
101
- }
102
-
103
- // TODO(dmaretskyi): Restore extraction logic.
104
- return { message: params.input.message, timeElapsed: 0 };
105
- };