@dxos/assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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/dist/lib/browser/index.mjs +1983 -64
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1976 -63
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1984 -64
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/{src/bin → bin}/chat.d.ts.map +1 -1
- package/dist/types/src/blueprint/blueprint.d.ts +79 -0
- package/dist/types/src/blueprint/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprint/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprint/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprint/index.d.ts +4 -0
- package/dist/types/src/blueprint/index.d.ts.map +1 -0
- package/dist/types/src/blueprint/logger.d.ts +3 -0
- package/dist/types/src/blueprint/logger.d.ts.map +1 -0
- package/dist/types/src/{ai-service/parser.d.ts → blueprint/machine.d.ts} +46 -68
- package/dist/types/src/blueprint/machine.d.ts.map +1 -0
- package/dist/types/src/blueprint/test-data.d.ts +3 -0
- package/dist/types/src/blueprint/test-data.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts +4 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-llm-function/extraction-llm-function.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts +2 -0
- package/dist/types/src/extraction/extraction-llm-function/index.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts +210 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-ner-function/extraction-ner-function.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts +3 -0
- package/dist/types/src/extraction/extraction-ner-function/index.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts +14 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts +2 -0
- package/dist/types/src/extraction/extraction-ner-function/named-entity-recognition.test.d.ts.map +1 -0
- package/dist/types/src/extraction/extraction.d.ts +242 -0
- package/dist/types/src/extraction/extraction.d.ts.map +1 -0
- package/dist/types/src/extraction/index.d.ts +5 -0
- package/dist/types/src/extraction/index.d.ts.map +1 -0
- package/dist/types/src/extraction/quotes.d.ts +15 -0
- package/dist/types/src/extraction/quotes.d.ts.map +1 -0
- package/dist/types/src/extraction/quotes.test.d.ts +2 -0
- package/dist/types/src/extraction/quotes.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/research/exa.d.ts +7 -0
- package/dist/types/src/research/exa.d.ts.map +1 -0
- package/dist/types/src/research/graph.d.ts +39 -0
- package/dist/types/src/research/graph.d.ts.map +1 -0
- package/dist/types/src/research/graph.test.d.ts +2 -0
- package/dist/types/src/research/graph.test.d.ts.map +1 -0
- package/dist/types/src/research/index.d.ts +4 -0
- package/dist/types/src/research/index.d.ts.map +1 -0
- package/dist/types/src/research/research.d.ts +10 -0
- package/dist/types/src/research/research.d.ts.map +1 -0
- package/dist/types/src/research/research.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +0 -1
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +47 -22
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +3 -4
- package/dist/types/src/session/version-pin.d.ts.map +1 -1
- package/dist/types/src/summarization/summarization.test.d.ts +2 -0
- package/dist/types/src/summarization/summarization.test.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337321991.d.ts +38 -0
- package/dist/types/src/testing/exa-search-1748337321991.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337331526.d.ts +37 -0
- package/dist/types/src/testing/exa-search-1748337331526.d.ts.map +1 -0
- package/dist/types/src/testing/exa-search-1748337344119.d.ts +58 -0
- package/dist/types/src/testing/exa-search-1748337344119.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -7
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +3 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/package.json +22 -38
- package/src/blueprint/blueprint.test.ts +142 -0
- package/src/blueprint/blueprint.ts +95 -0
- package/src/blueprint/index.ts +7 -0
- package/src/blueprint/logger.ts +66 -0
- package/src/blueprint/machine.ts +208 -0
- package/src/blueprint/test-data.ts +55 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.test.ts +95 -0
- package/src/extraction/extraction-llm-function/extraction-llm-function.ts +64 -0
- package/src/extraction/extraction-llm-function/index.ts +5 -0
- package/src/extraction/extraction-llm-function/instructions.tpl +28 -0
- package/src/extraction/extraction-ner-function/extraction-ner-function.test.ts +115 -0
- package/src/extraction/extraction-ner-function/extraction-ner-function.ts +54 -0
- package/src/extraction/extraction-ner-function/index.ts +6 -0
- package/src/extraction/extraction-ner-function/named-entity-recognition.test.ts +94 -0
- package/src/extraction/extraction-ner-function/named-entity-recognition.ts +97 -0
- package/src/extraction/extraction.ts +75 -0
- package/src/extraction/index.ts +8 -0
- package/src/extraction/quotes.test.ts +27 -0
- package/src/extraction/quotes.ts +57 -0
- package/src/index.ts +4 -4
- package/src/research/exa.ts +100 -0
- package/src/research/graph.test.ts +15 -0
- package/src/research/graph.ts +291 -0
- package/src/research/index.ts +7 -0
- package/src/research/instructions-research.tpl +97 -0
- package/src/research/research.test.ts +189 -0
- package/src/research/research.ts +89 -0
- package/src/session/index.ts +0 -1
- package/src/session/session.test.ts +7 -7
- package/src/session/session.ts +46 -19
- package/src/session/version-pin.ts +2 -3
- package/src/summarization/summarization.test.ts +216 -0
- package/src/testing/exa-search-1748337321991.ts +131 -0
- package/src/testing/exa-search-1748337331526.ts +144 -0
- package/src/testing/exa-search-1748337344119.ts +133 -0
- package/src/testing/index.ts +8 -8
- package/src/types.ts +8 -0
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/chunk-B4HAWUFW.mjs +0 -2786
- package/dist/lib/browser/chunk-B4HAWUFW.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -658
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/chunk-NOB7CIIC.cjs +0 -2791
- package/dist/lib/node/chunk-NOB7CIIC.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -672
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SAWYU3V5.mjs +0 -2788
- package/dist/lib/node-esm/chunk-SAWYU3V5.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -659
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/ai-service/client.test.d.ts +0 -2
- package/dist/types/src/ai-service/client.test.d.ts.map +0 -1
- package/dist/types/src/ai-service/defs.d.ts +0 -9
- package/dist/types/src/ai-service/defs.d.ts.map +0 -1
- package/dist/types/src/ai-service/edge-client.d.ts +0 -18
- package/dist/types/src/ai-service/edge-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/index.d.ts +0 -10
- package/dist/types/src/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/message-collector.d.ts +0 -82
- package/dist/types/src/ai-service/message-collector.d.ts.map +0 -1
- package/dist/types/src/ai-service/ollama-client.d.ts +0 -43
- package/dist/types/src/ai-service/ollama-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/parser.d.ts.map +0 -1
- package/dist/types/src/ai-service/service.d.ts +0 -25
- package/dist/types/src/ai-service/service.d.ts.map +0 -1
- package/dist/types/src/ai-service/stream.d.ts +0 -40
- package/dist/types/src/ai-service/stream.d.ts.map +0 -1
- package/dist/types/src/ai-service/stream.test.d.ts +0 -2
- package/dist/types/src/ai-service/stream.test.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/index.d.ts +0 -3
- package/dist/types/src/ai-service/testing/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/mock.d.ts +0 -11
- package/dist/types/src/ai-service/testing/mock.d.ts.map +0 -1
- package/dist/types/src/ai-service/testing/test-stream.d.ts +0 -7
- package/dist/types/src/ai-service/testing/test-stream.d.ts.map +0 -1
- package/dist/types/src/ai-service/transform.d.ts +0 -27
- package/dist/types/src/ai-service/transform.d.ts.map +0 -1
- package/dist/types/src/ai-service/types.d.ts +0 -210
- package/dist/types/src/ai-service/types.d.ts.map +0 -1
- package/dist/types/src/ai-service/util/index.d.ts +0 -2
- package/dist/types/src/ai-service/util/index.d.ts.map +0 -1
- package/dist/types/src/ai-service/util/sse.d.ts +0 -39
- package/dist/types/src/ai-service/util/sse.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/conversation.d.ts +0 -61
- package/dist/types/src/experimental/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/conversation.test.d.ts +0 -2
- package/dist/types/src/experimental/conversation/conversation.test.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/index.d.ts +0 -2
- package/dist/types/src/experimental/conversation/index.d.ts.map +0 -1
- package/dist/types/src/experimental/conversation/types.d.ts +0 -78
- package/dist/types/src/experimental/conversation/types.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/ast.d.ts +0 -56
- package/dist/types/src/experimental/cypher/ast.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/combinators.d.ts +0 -14
- package/dist/types/src/experimental/cypher/combinators.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/combinators.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/combinators.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/echo-data-source.d.ts +0 -16
- package/dist/types/src/experimental/cypher/echo-data-source.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/execution-plan.d.ts +0 -49
- package/dist/types/src/experimental/cypher/execution-plan.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/execution-plan.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/execution-plan.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/index.d.ts +0 -5
- package/dist/types/src/experimental/cypher/index.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/parjs.d.ts +0 -4
- package/dist/types/src/experimental/cypher/parjs.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/parser.d.ts +0 -6
- package/dist/types/src/experimental/cypher/parser.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/query-executor.d.ts +0 -26
- package/dist/types/src/experimental/cypher/query-executor.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/query-executor.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/query-executor.test.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/schema.d.ts +0 -12
- package/dist/types/src/experimental/cypher/schema.d.ts.map +0 -1
- package/dist/types/src/experimental/cypher/schema.test.d.ts +0 -2
- package/dist/types/src/experimental/cypher/schema.test.d.ts.map +0 -1
- package/dist/types/src/experimental/index.d.ts +0 -3
- package/dist/types/src/experimental/index.d.ts.map +0 -1
- package/dist/types/src/experimental/ner/ner.test.d.ts +0 -2
- package/dist/types/src/experimental/ner/ner.test.d.ts.map +0 -1
- package/dist/types/src/experimental/research/exa.d.ts +0 -6
- package/dist/types/src/experimental/research/exa.d.ts.map +0 -1
- package/dist/types/src/experimental/research/research.test.d.ts.map +0 -1
- package/dist/types/src/session/tools.d.ts +0 -18
- package/dist/types/src/session/tools.d.ts.map +0 -1
- package/dist/types/src/testing/artifacts.test.d.ts +0 -1
- package/dist/types/src/testing/artifacts.test.d.ts.map +0 -1
- package/dist/types/src/testing/data.d.ts +0 -2
- package/dist/types/src/testing/data.d.ts.map +0 -1
- package/dist/types/src/testing/defs.d.ts +0 -5
- package/dist/types/src/testing/defs.d.ts.map +0 -1
- package/dist/types/src/testing/logger.d.ts +0 -12
- package/dist/types/src/testing/logger.d.ts.map +0 -1
- package/dist/types/src/testing/object-extraction.test.d.ts +0 -1
- package/dist/types/src/testing/object-extraction.test.d.ts.map +0 -1
- package/dist/types/src/testing/ollama.d.ts +0 -6
- package/dist/types/src/testing/ollama.d.ts.map +0 -1
- package/dist/types/src/testing/printer.d.ts +0 -6
- package/dist/types/src/testing/printer.d.ts.map +0 -1
- package/dist/types/src/testing/query-promts.d.ts +0 -5
- package/dist/types/src/testing/query-promts.d.ts.map +0 -1
- package/dist/types/src/testing/query.test.d.ts +0 -2
- package/dist/types/src/testing/query.test.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -29
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -52
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/dist/types/src/util/index.d.ts +0 -2
- package/dist/types/src/util/index.d.ts.map +0 -1
- package/dist/types/src/util/trim.d.ts +0 -5
- package/dist/types/src/util/trim.d.ts.map +0 -1
- package/src/ai-service/client.test.ts +0 -247
- package/src/ai-service/defs.ts +0 -39
- package/src/ai-service/edge-client.ts +0 -60
- package/src/ai-service/index.ts +0 -13
- package/src/ai-service/message-collector.ts +0 -84
- package/src/ai-service/ollama-client.ts +0 -506
- package/src/ai-service/parser.ts +0 -369
- package/src/ai-service/service.ts +0 -31
- package/src/ai-service/stream.test.ts +0 -125
- package/src/ai-service/stream.ts +0 -118
- package/src/ai-service/testing/index.ts +0 -6
- package/src/ai-service/testing/mock.ts +0 -30
- package/src/ai-service/testing/test-stream.ts +0 -93
- package/src/ai-service/transform.ts +0 -121
- package/src/ai-service/types.ts +0 -112
- package/src/ai-service/util/index.ts +0 -5
- package/src/ai-service/util/sse.ts +0 -341
- package/src/bin/chat.ts +0 -79
- package/src/experimental/conversation/conversation.test.ts +0 -73
- package/src/experimental/conversation/conversation.ts +0 -142
- package/src/experimental/conversation/index.ts +0 -5
- package/src/experimental/conversation/types.ts +0 -126
- package/src/experimental/cypher/ast.ts +0 -75
- package/src/experimental/cypher/combinators.test.ts +0 -137
- package/src/experimental/cypher/combinators.ts +0 -148
- package/src/experimental/cypher/echo-data-source.ts +0 -105
- package/src/experimental/cypher/execution-plan.test.ts +0 -44
- package/src/experimental/cypher/execution-plan.ts +0 -208
- package/src/experimental/cypher/index.ts +0 -8
- package/src/experimental/cypher/parjs-shims.d.ts +0 -10
- package/src/experimental/cypher/parjs.ts +0 -10
- package/src/experimental/cypher/parser.ts +0 -19
- package/src/experimental/cypher/query-executor.test.ts +0 -47
- package/src/experimental/cypher/query-executor.ts +0 -145
- package/src/experimental/cypher/schema.test.ts +0 -17
- package/src/experimental/cypher/schema.ts +0 -86
- package/src/experimental/index.ts +0 -6
- package/src/experimental/ner/ner.test.ts +0 -163
- package/src/experimental/research/exa.ts +0 -38
- package/src/experimental/research/instructions.tpl +0 -64
- package/src/experimental/research/research.test.ts +0 -263
- package/src/session/tools.ts +0 -117
- package/src/testing/artifacts.test.ts +0 -182
- package/src/testing/data.ts +0 -13
- package/src/testing/defs.ts +0 -9
- package/src/testing/logger.ts +0 -129
- package/src/testing/object-extraction.test.ts +0 -71
- package/src/testing/ollama.ts +0 -15
- package/src/testing/printer.ts +0 -41
- package/src/testing/query-promts.ts +0 -75
- package/src/testing/query.test.ts +0 -88
- package/src/testing/test-data.ts +0 -379
- package/src/testing/test-schema.ts +0 -79
- package/src/util/index.ts +0 -5
- package/src/util/trim.ts +0 -15
- package/vendor/parjs-browser.mjs +0 -4
- package/vendor/parjs-default.mjs +0 -8
- /package/dist/types/{src/bin → bin}/chat.d.ts +0 -0
- /package/dist/types/src/{experimental/research → research}/research.test.d.ts +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type ExecutionPlan } from './execution-plan';
|
|
2
|
-
export interface DataSource {
|
|
3
|
-
getNodes: (params: {
|
|
4
|
-
label?: string;
|
|
5
|
-
}) => Promise<Node[]>;
|
|
6
|
-
getRelationships: (params: {
|
|
7
|
-
label?: string;
|
|
8
|
-
}) => Promise<Relationship[]>;
|
|
9
|
-
}
|
|
10
|
-
export type Node = {
|
|
11
|
-
id: string;
|
|
12
|
-
kind: 'node';
|
|
13
|
-
label: string;
|
|
14
|
-
properties: Record<string, unknown>;
|
|
15
|
-
};
|
|
16
|
-
export type Relationship = {
|
|
17
|
-
id: string;
|
|
18
|
-
kind: 'relationship';
|
|
19
|
-
label: string;
|
|
20
|
-
properties: Record<string, unknown>;
|
|
21
|
-
source: Node;
|
|
22
|
-
target: Node;
|
|
23
|
-
};
|
|
24
|
-
export declare const executeQueryPlan: (dataSource: DataSource, plan: ExecutionPlan) => Promise<Record<string, unknown>[]>;
|
|
25
|
-
export declare const executeQuery: (dataSource: DataSource, query: string) => Promise<Record<string, unknown>[]>;
|
|
26
|
-
//# sourceMappingURL=query-executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-executor.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/query-executor.ts"],"names":[],"mappings":"AAQA,OAAO,EAAuB,KAAK,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AAG9F,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,gBAAgB,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,YAAY,UAAU,EACtB,MAAM,aAAa,KAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAsFnC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,YAAY,UAAU,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAGrG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-executor.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/query-executor.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type JsonSchemaType } from '@dxos/echo-schema';
|
|
2
|
-
/**
|
|
3
|
-
* Formats ECHO schema to be consumed by LLM.
|
|
4
|
-
* Schema is formatted in cypher format.
|
|
5
|
-
* Objects are represented as nodes.
|
|
6
|
-
* References are represented as relationships.
|
|
7
|
-
*/
|
|
8
|
-
export declare const formatJsonSchemaForLLM: (schemaTypes: JsonSchemaType[]) => string[];
|
|
9
|
-
export declare const formatNodeLabel: (typename: string) => string;
|
|
10
|
-
export declare const formatInferredRelationshipLabel: (typename: string, property: string) => string;
|
|
11
|
-
export declare const isReference: (schema: JsonSchemaType) => boolean;
|
|
12
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIjF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,cAAc,EAAE,KAAG,MAAM,EAK5E,CAAC;AAkDF,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,WAE/C,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,WAGjF,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,cAAc,YAMD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/cypher/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ner.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/ner/ner.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exa.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/research/exa.ts"],"names":[],"mappings":"AAUA,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,YAAY,oBAAoB,kCAuB7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"research.test.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/research/research.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Message, type Tool } from '@dxos/artifact';
|
|
2
|
-
export declare const isToolUse: (message: Message, { onlyToolNames }?: {
|
|
3
|
-
onlyToolNames?: string[];
|
|
4
|
-
}) => boolean;
|
|
5
|
-
export type RunToolsOptions = {
|
|
6
|
-
message: Message;
|
|
7
|
-
tools: Tool[];
|
|
8
|
-
extensions?: ToolContextExtensions;
|
|
9
|
-
};
|
|
10
|
-
export type RunToolsResult = {
|
|
11
|
-
type: 'continue';
|
|
12
|
-
message: Message;
|
|
13
|
-
} | {
|
|
14
|
-
type: 'break';
|
|
15
|
-
result: unknown;
|
|
16
|
-
};
|
|
17
|
-
export declare const runTools: ({ message, tools, extensions }: RunToolsOptions) => Promise<RunToolsResult>;
|
|
18
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../src/session/tools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,gBAAgB,CAAC;AAKhE,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,EAAE,oBAAmB;IAAE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,YAI/F,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN,eAAO,MAAM,QAAQ,GAAU,gCAAgC,eAAe,KAAG,OAAO,CAAC,cAAc,CAqFtG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=artifacts.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/artifacts.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/testing/data.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,UAQzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/testing/defs.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ImageSource } from '@dxos/artifact';
|
|
2
|
-
import type { ConversationEvent } from '../experimental';
|
|
3
|
-
export declare const createLogger: ({ stream, filter, onImage, }?: {
|
|
4
|
-
stream?: boolean;
|
|
5
|
-
filter?: (event: ConversationEvent) => boolean;
|
|
6
|
-
onImage?: (img: {
|
|
7
|
-
id: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
source: ImageSource;
|
|
10
|
-
}) => void;
|
|
11
|
-
}) => (event: ConversationEvent) => void;
|
|
12
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,eAAO,MAAM,YAAY,GAAI,+BAI1B;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/E,MAII,OAAO,iBAAiB,SA4GjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=object-extraction.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-extraction.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/object-extraction.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { OllamaClient, type OllamaClientParams } from '../ai-service';
|
|
2
|
-
/**
|
|
3
|
-
* Create a test client with small local model and no temperature for predictable results.
|
|
4
|
-
*/
|
|
5
|
-
export declare const createTestOllamaClient: (options?: Pick<OllamaClientParams, "tools">) => OllamaClient;
|
|
6
|
-
//# sourceMappingURL=ollama.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../../src/testing/ollama.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,iBAKjF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../../../../src/testing/printer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,cAAc;IACzB,YAAY,GAAI,SAAS,OAAO,UAM9B;IAEF,iBAAiB,GAAI,SAAS,mBAAmB,UAsB/C;CACH"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
import { type DataSource } from '../experimental';
|
|
3
|
-
export declare const createCypherTool: (dataSource: DataSource, schemaTypes?: Schema.Schema.Any[]) => import("@dxos/artifact").Tool;
|
|
4
|
-
export declare const createSystemPrompt: (schemaTypes: Schema.Schema.Any[]) => string;
|
|
5
|
-
//# sourceMappingURL=query-promts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-promts.d.ts","sourceRoot":"","sources":["../../../../src/testing/query-promts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGxF,eAAO,MAAM,gBAAgB,GAAI,YAAY,UAAU,EAAE,cAAa,MAAM,CAAC,MAAM,CAAC,GAAG,EAAO,kCA0C1F,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAiBlE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/query.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type Schema } from 'effect';
|
|
2
|
-
import type { EchoDatabase } from '@dxos/echo-db';
|
|
3
|
-
import { type JsonSchemaType } from '@dxos/echo-schema';
|
|
4
|
-
import { type DataSource, type Node, type Relationship } from '../experimental';
|
|
5
|
-
export declare const seedTestData: (db: EchoDatabase) => void;
|
|
6
|
-
export declare const createTestData: () => MockDataSource;
|
|
7
|
-
export declare class MockDataSource implements DataSource {
|
|
8
|
-
objects: Record<string, {
|
|
9
|
-
schema: Schema.Schema.All;
|
|
10
|
-
typeDxn: string;
|
|
11
|
-
id: string;
|
|
12
|
-
data: unknown;
|
|
13
|
-
}>;
|
|
14
|
-
schema: Record<string, {
|
|
15
|
-
json: JsonSchemaType;
|
|
16
|
-
instance: Schema.Schema.All;
|
|
17
|
-
}>;
|
|
18
|
-
nodes: Node[];
|
|
19
|
-
relationships: Relationship[];
|
|
20
|
-
getNodes({ label }: {
|
|
21
|
-
label?: string;
|
|
22
|
-
}): Promise<Node[]>;
|
|
23
|
-
getRelationships({ label }: {
|
|
24
|
-
label?: string;
|
|
25
|
-
}): Promise<Relationship[]>;
|
|
26
|
-
add<S extends Schema.Schema.All>(schema: S, data: Schema.Schema.Type<S>): Schema.Schema.Type<S>;
|
|
27
|
-
computeGraph(): void;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=test-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-data.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-data.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAIL,KAAK,cAAc,EAGpB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,YAAY,EAGlB,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,YAAY,GAAI,IAAI,YAAY,SAoH5C,CAAC;AAGF,eAAO,MAAM,cAAc,QAAO,cAuGjC,CAAC;AAEF,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,EAAE,MAAM,CACb,MAAM,EACN;QACE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,OAAO,CAAC;KACf,CACF,CAAM;IAEP,MAAM,EAAE,MAAM,CACZ,MAAM,EACN;QACE,IAAI,EAAE,cAAc,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;KAC7B,CACF,CAAM;IAEP,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,aAAa,EAAE,YAAY,EAAE,CAAM;IAE7B,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAItC,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAIpD,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAsBvE,YAAY;CA0Eb"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
2
|
-
/** @deprecated */
|
|
3
|
-
export declare const Contact: Schema.mutable<Schema.Struct<{
|
|
4
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
5
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
6
|
-
email: Schema.optional<typeof Schema.String>;
|
|
7
|
-
}>>;
|
|
8
|
-
export interface Contact extends Schema.Schema.Type<typeof Contact> {
|
|
9
|
-
}
|
|
10
|
-
/** @deprecated */
|
|
11
|
-
export declare const Project: Schema.mutable<Schema.Struct<{
|
|
12
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
13
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
14
|
-
description: Schema.optional<typeof Schema.String>;
|
|
15
|
-
}>>;
|
|
16
|
-
export interface Project extends Schema.Schema.Type<typeof Project> {
|
|
17
|
-
}
|
|
18
|
-
export declare const Task: Schema.mutable<Schema.Struct<{
|
|
19
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
20
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
21
|
-
description: Schema.optional<typeof Schema.String>;
|
|
22
|
-
project: import("@dxos/echo-schema").Ref$<{
|
|
23
|
-
name: string;
|
|
24
|
-
description?: string | undefined;
|
|
25
|
-
id: string;
|
|
26
|
-
}>;
|
|
27
|
-
assignee: import("@dxos/echo-schema").Ref$<{
|
|
28
|
-
name: string;
|
|
29
|
-
id: string;
|
|
30
|
-
email?: string | undefined;
|
|
31
|
-
}>;
|
|
32
|
-
}>>;
|
|
33
|
-
export interface Task extends Schema.Schema.Type<typeof Task> {
|
|
34
|
-
}
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
export declare const Organization: Schema.mutable<Schema.Struct<{
|
|
37
|
-
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
38
|
-
name: Schema.SchemaClass<string, string, never>;
|
|
39
|
-
projects: Schema.Array$<import("@dxos/echo-schema").Ref$<{
|
|
40
|
-
name: string;
|
|
41
|
-
description?: string | undefined;
|
|
42
|
-
id: string;
|
|
43
|
-
}>>;
|
|
44
|
-
employees: Schema.Array$<import("@dxos/echo-schema").Ref$<{
|
|
45
|
-
name: string;
|
|
46
|
-
id: string;
|
|
47
|
-
email?: string | undefined;
|
|
48
|
-
}>>;
|
|
49
|
-
}>>;
|
|
50
|
-
export interface Organization extends Schema.Schema.Type<typeof Organization> {
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=test-schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMhC,kBAAkB;AAClB,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEtE,kBAAkB;AAClB,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEtE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAEhE,kBAAkB;AAClB,eAAO,MAAM,YAAY;;;;;;;;;;;;;GAcrB,CAAC;AACL,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trim.d.ts","sourceRoot":"","sources":["../../../../src/util/trim.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,eAAO,MAAM,IAAI,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,GAAG,EAAE,WAMnE,CAAC"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
import { test, describe } from 'vitest';
|
|
7
|
-
|
|
8
|
-
import { defineTool, Message, ToolResult, type Tool } from '@dxos/artifact';
|
|
9
|
-
import { toJsonSchema, create } from '@dxos/echo-schema';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { log } from '@dxos/log';
|
|
12
|
-
|
|
13
|
-
import { DEFAULT_EDGE_MODEL } from './defs';
|
|
14
|
-
import { AIServiceEdgeClient } from './edge-client';
|
|
15
|
-
import { OllamaClient } from './ollama-client';
|
|
16
|
-
import { MixedStreamParser } from './parser';
|
|
17
|
-
import { ToolTypes } from './types';
|
|
18
|
-
import { createTestOllamaClient, AI_SERVICE_ENDPOINT } from '../testing';
|
|
19
|
-
|
|
20
|
-
// log.config({ filter: 'debug' });
|
|
21
|
-
|
|
22
|
-
describe.skip('AI Service Client', () => {
|
|
23
|
-
test('client generation', async () => {
|
|
24
|
-
const client = new AIServiceEdgeClient({
|
|
25
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// await client.appendMessages([
|
|
29
|
-
// {
|
|
30
|
-
// id: ObjectId.random(),
|
|
31
|
-
// spaceId,
|
|
32
|
-
// threadId,
|
|
33
|
-
// role: 'user',
|
|
34
|
-
// content: [{ type: 'text', text: 'Hello' }],
|
|
35
|
-
// },
|
|
36
|
-
// ]);
|
|
37
|
-
|
|
38
|
-
const stream = await client.execStream({
|
|
39
|
-
model: DEFAULT_EDGE_MODEL,
|
|
40
|
-
systemPrompt: 'You are a poet',
|
|
41
|
-
tools: [],
|
|
42
|
-
});
|
|
43
|
-
for await (const event of stream) {
|
|
44
|
-
log('event', event);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
log('full message', {
|
|
48
|
-
message: await stream.complete(),
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('tool calls', async () => {
|
|
53
|
-
const client = new AIServiceEdgeClient({
|
|
54
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const custodian: Tool = {
|
|
58
|
-
name: 'custodian',
|
|
59
|
-
description: 'Custodian can tell you the password if you say the magic word',
|
|
60
|
-
parameters: toJsonSchema(
|
|
61
|
-
Schema.Struct({
|
|
62
|
-
magicWord: Schema.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
|
|
63
|
-
}),
|
|
64
|
-
),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// await client.appendMessages([
|
|
68
|
-
// {
|
|
69
|
-
// id: ObjectId.random(),
|
|
70
|
-
// spaceId,
|
|
71
|
-
// threadId,
|
|
72
|
-
// role: 'user',
|
|
73
|
-
// content: [{ type: 'text', text: 'What is the password? Ask the custodian' }],
|
|
74
|
-
// },
|
|
75
|
-
// ]);
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
const stream1 = await client.execStream({
|
|
79
|
-
model: DEFAULT_EDGE_MODEL,
|
|
80
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
81
|
-
tools: [custodian],
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
for await (const event of stream1) {
|
|
85
|
-
log('event', event);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// TODO(burdon): !!!
|
|
89
|
-
await stream1.complete();
|
|
90
|
-
const messages: Message[] = [];
|
|
91
|
-
|
|
92
|
-
const [message1] = messages;
|
|
93
|
-
log('full message', { message: message1 });
|
|
94
|
-
// await client.appendMessages([message1]);
|
|
95
|
-
|
|
96
|
-
const toolUse = message1.content.find(({ type }) => type === 'tool_use')!;
|
|
97
|
-
invariant(toolUse.type === 'tool_use');
|
|
98
|
-
// await client.appendMessages([
|
|
99
|
-
// {
|
|
100
|
-
// id: ObjectId.random(),
|
|
101
|
-
// spaceId,
|
|
102
|
-
// threadId,
|
|
103
|
-
// role: 'user',
|
|
104
|
-
// content: [{ type: 'tool_result', toolUseId: toolUse.id, content: 'password="The sky is blue"' }],
|
|
105
|
-
// },
|
|
106
|
-
// ]);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
{
|
|
110
|
-
const stream2 = await client.execStream({
|
|
111
|
-
model: DEFAULT_EDGE_MODEL,
|
|
112
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
113
|
-
tools: [custodian],
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
for await (const event of stream2) {
|
|
117
|
-
log('event', event);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
await stream2.complete();
|
|
121
|
-
const messages: Message[] = [];
|
|
122
|
-
|
|
123
|
-
const [message2] = messages;
|
|
124
|
-
log('full message', { message: message2 });
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test.skip('image generation', async () => {
|
|
129
|
-
const client = new AIServiceEdgeClient({
|
|
130
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// await client.appendMessages([
|
|
134
|
-
// {
|
|
135
|
-
// id: ObjectId.random(),
|
|
136
|
-
// spaceId,
|
|
137
|
-
// threadId,
|
|
138
|
-
// role: 'user',
|
|
139
|
-
// content: [{ type: 'text', text: 'Generate an image of a cat' }],
|
|
140
|
-
// },
|
|
141
|
-
// ]);
|
|
142
|
-
|
|
143
|
-
const stream = await client.execStream({
|
|
144
|
-
model: DEFAULT_EDGE_MODEL,
|
|
145
|
-
tools: [
|
|
146
|
-
{
|
|
147
|
-
name: 'text-to-image',
|
|
148
|
-
type: ToolTypes.TextToImage,
|
|
149
|
-
// options: {
|
|
150
|
-
// model: '@cf/stabilityai/stable-diffusion-xl-base-1.0',
|
|
151
|
-
// },
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
for await (const event of stream) {
|
|
157
|
-
log('event', event);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
log('full message', { message: await stream.complete() });
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe.skip('Ollama Client', () => {
|
|
165
|
-
test('basic', async (ctx) => {
|
|
166
|
-
const isRunning = await OllamaClient.isRunning();
|
|
167
|
-
if (!isRunning) {
|
|
168
|
-
ctx.skip();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const client = createTestOllamaClient();
|
|
172
|
-
const parser = new MixedStreamParser();
|
|
173
|
-
|
|
174
|
-
const messages = await parser.parse(
|
|
175
|
-
await client.execStream({
|
|
176
|
-
prompt: create(Message, {
|
|
177
|
-
role: 'user',
|
|
178
|
-
content: [{ type: 'text', text: 'Hello, world!' }],
|
|
179
|
-
}),
|
|
180
|
-
}),
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
log('messages', { messages });
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
test('tool calls', async (ctx) => {
|
|
187
|
-
const isRunning = await OllamaClient.isRunning();
|
|
188
|
-
if (!isRunning) {
|
|
189
|
-
ctx.skip();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const client = createTestOllamaClient({
|
|
193
|
-
tools: [
|
|
194
|
-
defineTool('test', {
|
|
195
|
-
name: 'encrypt',
|
|
196
|
-
description: 'Encrypt a message',
|
|
197
|
-
schema: Schema.Struct({
|
|
198
|
-
message: Schema.String.annotations({ description: 'The message to encrypt' }),
|
|
199
|
-
}),
|
|
200
|
-
execute: async ({ message }) => ToolResult.Success(message.split('').reverse().join('')),
|
|
201
|
-
}),
|
|
202
|
-
],
|
|
203
|
-
});
|
|
204
|
-
const parser = new MixedStreamParser();
|
|
205
|
-
parser.streamEvent.on((event) => {
|
|
206
|
-
// log('event', { event });
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const messages = await parser.parse(
|
|
210
|
-
await client.execStream({
|
|
211
|
-
prompt: create(Message, {
|
|
212
|
-
role: 'user',
|
|
213
|
-
content: [{ type: 'text', text: 'What is the encrypted message for "Hello, world!"' }],
|
|
214
|
-
}),
|
|
215
|
-
}),
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
log('messages', { messages });
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
test('text-to-image', async (ctx) => {
|
|
222
|
-
const isRunning = await OllamaClient.isRunning();
|
|
223
|
-
if (!isRunning) {
|
|
224
|
-
ctx.skip();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const client = createTestOllamaClient();
|
|
228
|
-
const parser = new MixedStreamParser();
|
|
229
|
-
|
|
230
|
-
const messages = await parser.parse(
|
|
231
|
-
await client.execStream({
|
|
232
|
-
prompt: create(Message, {
|
|
233
|
-
role: 'user',
|
|
234
|
-
content: [{ type: 'text', text: 'Generate an image of a cat' }],
|
|
235
|
-
}),
|
|
236
|
-
tools: [
|
|
237
|
-
{
|
|
238
|
-
name: 'text-to-image',
|
|
239
|
-
type: ToolTypes.TextToImage,
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
}),
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
log('messages', { messages });
|
|
246
|
-
});
|
|
247
|
-
});
|
package/src/ai-service/defs.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// TODO(burdon): Share with Edge.
|
|
6
|
-
// TODO(burdon): Move to service config retrieved by HTTP?
|
|
7
|
-
|
|
8
|
-
export const DEFAULT_EDGE_MODEL = '@anthropic/claude-3-5-sonnet-20241022';
|
|
9
|
-
|
|
10
|
-
export const DEFAULT_EDGE_MODELS = [
|
|
11
|
-
// AI Gateway.
|
|
12
|
-
// https://developers.cloudflare.com/ai-gateway
|
|
13
|
-
'@anthropic/claude-3-5-haiku-20241022',
|
|
14
|
-
'@anthropic/claude-3-5-sonnet-20241022',
|
|
15
|
-
'@anthropic/claude-3-7-sonnet-20250219',
|
|
16
|
-
|
|
17
|
-
// Workers AI.
|
|
18
|
-
// https://developers.cloudflare.com/workers-ai/models
|
|
19
|
-
'@cf/deepseek-ai/deepseek-r1-distill-qwen-32b',
|
|
20
|
-
'@hf/nousresearch/hermes-2-pro-mistral-7b',
|
|
21
|
-
'@ollama/llama-3-1-nemotron-70b-instruct',
|
|
22
|
-
'@ollama/llama-3-1-nemotron-mini-4b-instruct',
|
|
23
|
-
'@ollama/llama-3-2-3b',
|
|
24
|
-
] as const;
|
|
25
|
-
|
|
26
|
-
// TODO(burdon): Config.
|
|
27
|
-
export const DEFAULT_OLLAMA_ENDPOINT = 'http://localhost:11434';
|
|
28
|
-
|
|
29
|
-
export const DEFAULT_OLLAMA_MODEL = 'llama3.2:1b';
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* https://ollama.com/library
|
|
33
|
-
*/
|
|
34
|
-
export const DEFAULT_OLLAMA_MODELS = [
|
|
35
|
-
//
|
|
36
|
-
'llama3.2:1b',
|
|
37
|
-
'llama3:70b',
|
|
38
|
-
'deepseek-r1:latest',
|
|
39
|
-
] as const;
|