@dxos/assistant 0.8.2-staging.7ac8446 → 0.8.3-main.672df60
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 +1909 -228
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1907 -229
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1910 -228
- 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 +51 -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 +12 -0
- package/dist/types/src/blueprint/logger.d.ts.map +1 -0
- package/dist/types/src/blueprint/machine.d.ts +122 -0
- 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 -3
- 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 +40 -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 +2 -0
- package/dist/types/src/research/research.test.d.ts.map +1 -0
- package/dist/types/src/session/index.d.ts +1 -0
- package/dist/types/src/session/index.d.ts.map +1 -1
- package/dist/types/src/session/session.d.ts +80 -35
- package/dist/types/src/session/session.d.ts.map +1 -1
- package/dist/types/src/session/version-pin.d.ts +21 -0
- package/dist/types/src/session/version-pin.d.ts.map +1 -0
- package/dist/types/src/session/version-pin.test.d.ts +2 -0
- package/dist/types/src/session/version-pin.test.d.ts.map +1 -0
- 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 -6
- 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/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -35
- package/src/blueprint/blueprint.test.ts +149 -0
- package/src/blueprint/blueprint.ts +71 -0
- package/src/blueprint/index.ts +7 -0
- package/src/blueprint/logger.ts +109 -0
- package/src/blueprint/machine.ts +214 -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 -3
- package/src/research/exa.ts +100 -0
- package/src/research/graph.test.ts +15 -0
- package/src/research/graph.ts +339 -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 +1 -0
- package/src/session/session.test.ts +39 -67
- package/src/session/session.ts +328 -155
- package/src/session/version-pin.test.ts +26 -0
- package/src/session/version-pin.ts +48 -0
- 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 -7
- package/src/typedefs.d.ts +8 -0
- package/src/types.ts +8 -0
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/chunk-PND5VR6D.mjs +0 -2315
- package/dist/lib/browser/chunk-PND5VR6D.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -621
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node/chunk-IBOBRBDF.cjs +0 -2326
- package/dist/lib/node/chunk-IBOBRBDF.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -637
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCQJOLSR.mjs +0 -2317
- package/dist/lib/node-esm/chunk-DCQJOLSR.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -622
- 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 -19
- 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 -88
- package/dist/types/src/ai-service/message-collector.d.ts.map +0 -1
- package/dist/types/src/ai-service/ollama-client.d.ts +0 -39
- package/dist/types/src/ai-service/ollama-client.d.ts.map +0 -1
- package/dist/types/src/ai-service/parser.d.ts +0 -138
- package/dist/types/src/ai-service/parser.d.ts.map +0 -1
- package/dist/types/src/ai-service/service.d.ts +0 -9
- 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 -7
- 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 -167
- 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/conversation/conversation.d.ts +0 -80
- package/dist/types/src/conversation/conversation.d.ts.map +0 -1
- package/dist/types/src/conversation/conversation.test.d.ts +0 -2
- package/dist/types/src/conversation/conversation.test.d.ts.map +0 -1
- package/dist/types/src/conversation/index.d.ts +0 -2
- package/dist/types/src/conversation/index.d.ts.map +0 -1
- package/dist/types/src/conversation/types.d.ts +0 -79
- package/dist/types/src/conversation/types.d.ts.map +0 -1
- package/dist/types/src/cypher/ast.d.ts +0 -56
- package/dist/types/src/cypher/ast.d.ts.map +0 -1
- package/dist/types/src/cypher/combinators.d.ts +0 -14
- package/dist/types/src/cypher/combinators.d.ts.map +0 -1
- package/dist/types/src/cypher/combinators.test.d.ts +0 -2
- package/dist/types/src/cypher/combinators.test.d.ts.map +0 -1
- package/dist/types/src/cypher/echo-data-source.d.ts +0 -16
- package/dist/types/src/cypher/echo-data-source.d.ts.map +0 -1
- package/dist/types/src/cypher/execution-plan.d.ts +0 -49
- package/dist/types/src/cypher/execution-plan.d.ts.map +0 -1
- package/dist/types/src/cypher/execution-plan.test.d.ts +0 -2
- package/dist/types/src/cypher/execution-plan.test.d.ts.map +0 -1
- package/dist/types/src/cypher/index.d.ts +0 -5
- package/dist/types/src/cypher/index.d.ts.map +0 -1
- package/dist/types/src/cypher/parjs.d.ts +0 -4
- package/dist/types/src/cypher/parjs.d.ts.map +0 -1
- package/dist/types/src/cypher/parser.d.ts +0 -6
- package/dist/types/src/cypher/parser.d.ts.map +0 -1
- package/dist/types/src/cypher/query-executor.d.ts +0 -26
- package/dist/types/src/cypher/query-executor.d.ts.map +0 -1
- package/dist/types/src/cypher/query-executor.test.d.ts +0 -2
- package/dist/types/src/cypher/query-executor.test.d.ts.map +0 -1
- package/dist/types/src/cypher/schema.d.ts +0 -12
- package/dist/types/src/cypher/schema.d.ts.map +0 -1
- package/dist/types/src/cypher/schema.test.d.ts +0 -2
- package/dist/types/src/cypher/schema.test.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/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 -50
- 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 -265
- package/src/ai-service/defs.ts +0 -39
- package/src/ai-service/edge-client.ts +0 -67
- 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 -499
- package/src/ai-service/parser.ts +0 -358
- package/src/ai-service/service.ts +0 -15
- 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 -22
- 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 -103
- 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/conversation/conversation.test.ts +0 -73
- package/src/conversation/conversation.ts +0 -257
- package/src/conversation/index.ts +0 -5
- package/src/conversation/types.ts +0 -129
- package/src/cypher/ast.ts +0 -75
- package/src/cypher/combinators.test.ts +0 -137
- package/src/cypher/combinators.ts +0 -148
- package/src/cypher/echo-data-source.ts +0 -105
- package/src/cypher/execution-plan.test.ts +0 -44
- package/src/cypher/execution-plan.ts +0 -208
- package/src/cypher/index.ts +0 -8
- package/src/cypher/parjs-shims.d.ts +0 -10
- package/src/cypher/parjs.ts +0 -10
- package/src/cypher/parser.ts +0 -19
- package/src/cypher/query-executor.test.ts +0 -47
- package/src/cypher/query-executor.ts +0 -145
- package/src/cypher/schema.test.ts +0 -17
- package/src/cypher/schema.ts +0 -86
- 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/query-promts.ts +0 -75
- package/src/testing/query.test.ts +0 -91
- package/src/testing/test-data.ts +0 -372
- package/src/testing/test-schema.ts +0 -80
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-executor.d.ts","sourceRoot":"","sources":["../../../../src/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,eACf,UAAU,QAChB,aAAa,KAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAsFnC,CAAC;AAEF,eAAO,MAAM,YAAY,eAAgB,UAAU,SAAS,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/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/cypher/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIjF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,gBAAiB,cAAc,EAAE,KAAG,MAAM,EAK5E,CAAC;AAkDF,eAAO,MAAM,eAAe,aAAc,MAAM,WAE/C,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAAc,MAAM,YAAY,MAAM,WAGjF,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,cAAc,YAMD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.test.d.ts","sourceRoot":"","sources":["../../../../src/cypher/schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -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 '../conversation';
|
|
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,kCAItB;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;CACpF,aAIgB,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,aAAc,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,iBAKjF,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Schema as S } from 'effect';
|
|
2
|
-
import { type DataSource } from '../cypher';
|
|
3
|
-
export declare const createCypherTool: (dataSource: DataSource, schemaTypes?: S.Schema.Any[]) => import("@dxos/artifact").Tool;
|
|
4
|
-
export declare const createSystemPrompt: (schemaTypes: S.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,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAMrC,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGlF,eAAO,MAAM,gBAAgB,eAAgB,UAAU,gBAAe,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,kCA0ChF,CAAC;AAEL,eAAO,MAAM,kBAAkB,gBAAiB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,WAiB7D,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 as S } 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 '../cypher';
|
|
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: S.Schema.All;
|
|
10
|
-
typeDxn: string;
|
|
11
|
-
id: string;
|
|
12
|
-
data: unknown;
|
|
13
|
-
}>;
|
|
14
|
-
schema: Record<string, {
|
|
15
|
-
json: JsonSchemaType;
|
|
16
|
-
instance: S.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 S.Schema.All>(schema: S, data: S.Schema.Type<S>): S.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,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAmD,KAAK,cAAc,EAAY,MAAM,mBAAmB,CAAC;AAInH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,YAAY,EAGlB,MAAM,WAAW,CAAC;AAGnB,eAAO,MAAM,YAAY,OAAQ,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,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACrB,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,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;KACxB,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,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAsB7D,YAAY;CA0Eb"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Schema as S } from 'effect';
|
|
2
|
-
export declare const ObjectId: S.SchemaClass<string, string, never>;
|
|
3
|
-
export declare const Contact: S.mutable<S.Struct<{
|
|
4
|
-
id: S.SchemaClass<string, string, never>;
|
|
5
|
-
name: S.SchemaClass<string, string, never>;
|
|
6
|
-
email: S.optional<typeof S.String>;
|
|
7
|
-
}>>;
|
|
8
|
-
export interface Contact extends S.Schema.Type<typeof Contact> {
|
|
9
|
-
}
|
|
10
|
-
export declare const Project: S.mutable<S.Struct<{
|
|
11
|
-
id: S.SchemaClass<string, string, never>;
|
|
12
|
-
name: S.SchemaClass<string, string, never>;
|
|
13
|
-
description: S.optional<typeof S.String>;
|
|
14
|
-
}>>;
|
|
15
|
-
export interface Project extends S.Schema.Type<typeof Project> {
|
|
16
|
-
}
|
|
17
|
-
export declare const Task: S.mutable<S.Struct<{
|
|
18
|
-
id: S.SchemaClass<string, string, never>;
|
|
19
|
-
name: S.SchemaClass<string, string, never>;
|
|
20
|
-
description: S.optional<typeof S.String>;
|
|
21
|
-
project: import("@dxos/echo-schema").Ref$<{
|
|
22
|
-
name: string;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
id: string;
|
|
25
|
-
}>;
|
|
26
|
-
assignee: import("@dxos/echo-schema").Ref$<{
|
|
27
|
-
name: string;
|
|
28
|
-
id: string;
|
|
29
|
-
email?: string | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
}>>;
|
|
32
|
-
export interface Task extends S.Schema.Type<typeof Task> {
|
|
33
|
-
}
|
|
34
|
-
export declare const Org: S.mutable<S.Struct<{
|
|
35
|
-
id: S.SchemaClass<string, string, never>;
|
|
36
|
-
name: S.SchemaClass<string, string, never>;
|
|
37
|
-
projects: S.Array$<import("@dxos/echo-schema").Ref$<{
|
|
38
|
-
name: string;
|
|
39
|
-
description?: string | undefined;
|
|
40
|
-
id: string;
|
|
41
|
-
}>>;
|
|
42
|
-
employees: S.Array$<import("@dxos/echo-schema").Ref$<{
|
|
43
|
-
name: string;
|
|
44
|
-
id: string;
|
|
45
|
-
email?: string | undefined;
|
|
46
|
-
}>>;
|
|
47
|
-
}>>;
|
|
48
|
-
export interface Org extends S.Schema.Type<typeof Org> {
|
|
49
|
-
}
|
|
50
|
-
//# 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,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,QAAQ,sCAAyE,CAAC;AAE/F,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,OAAO;;;;GAahB,CAAC;AACL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC;CAAG;AAEjE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;GAeb,CAAC;AACL,MAAM,WAAW,IAAK,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;CAAG;AAE3D,eAAO,MAAM,GAAG;;;;;;;;;;;;;GAcZ,CAAC;AACL,MAAM,WAAW,GAAI,SAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,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,YAAa,oBAAoB,aAAa,GAAG,EAAE,WAMnE,CAAC"}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema as S } from 'effect';
|
|
6
|
-
import { test, describe } from 'vitest';
|
|
7
|
-
|
|
8
|
-
import { defineTool, Message, ToolResult, type Tool } from '@dxos/artifact';
|
|
9
|
-
import { toJsonSchema, ObjectId, createStatic } from '@dxos/echo-schema';
|
|
10
|
-
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import { SpaceId } from '@dxos/keys';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
|
|
14
|
-
import { DEFAULT_EDGE_MODEL } from './defs';
|
|
15
|
-
import { AIServiceEdgeClient } from './edge-client';
|
|
16
|
-
import { OllamaClient } from './ollama-client';
|
|
17
|
-
import { MixedStreamParser } from './parser';
|
|
18
|
-
import { ToolTypes } from './types';
|
|
19
|
-
import { createTestOllamaClient, AI_SERVICE_ENDPOINT } from '../testing';
|
|
20
|
-
|
|
21
|
-
// log.config({ filter: 'debug' });
|
|
22
|
-
|
|
23
|
-
describe.skip('AI Service Client', () => {
|
|
24
|
-
test('client generation', async () => {
|
|
25
|
-
const client = new AIServiceEdgeClient({
|
|
26
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const spaceId = SpaceId.random();
|
|
30
|
-
const threadId = ObjectId.random();
|
|
31
|
-
|
|
32
|
-
await client.appendMessages([
|
|
33
|
-
{
|
|
34
|
-
id: ObjectId.random(),
|
|
35
|
-
spaceId,
|
|
36
|
-
threadId,
|
|
37
|
-
role: 'user',
|
|
38
|
-
content: [{ type: 'text', text: 'Hello' }],
|
|
39
|
-
},
|
|
40
|
-
]);
|
|
41
|
-
|
|
42
|
-
const stream = await client.exec({
|
|
43
|
-
model: DEFAULT_EDGE_MODEL,
|
|
44
|
-
spaceId,
|
|
45
|
-
threadId,
|
|
46
|
-
systemPrompt: 'You are a poet',
|
|
47
|
-
tools: [],
|
|
48
|
-
});
|
|
49
|
-
for await (const event of stream) {
|
|
50
|
-
log('event', event);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
log('full message', {
|
|
54
|
-
message: await stream.complete(),
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('tool calls', async () => {
|
|
59
|
-
const client = new AIServiceEdgeClient({
|
|
60
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const custodian: Tool = {
|
|
64
|
-
name: 'custodian',
|
|
65
|
-
description: 'Custodian can tell you the password if you say the magic word',
|
|
66
|
-
parameters: toJsonSchema(
|
|
67
|
-
S.Struct({
|
|
68
|
-
magicWord: S.String.annotations({ description: 'The magic word. Should be exactly "pretty please"' }),
|
|
69
|
-
}),
|
|
70
|
-
),
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const spaceId = SpaceId.random();
|
|
74
|
-
const threadId = ObjectId.random();
|
|
75
|
-
|
|
76
|
-
await client.appendMessages([
|
|
77
|
-
{
|
|
78
|
-
id: ObjectId.random(),
|
|
79
|
-
spaceId,
|
|
80
|
-
threadId,
|
|
81
|
-
role: 'user',
|
|
82
|
-
content: [{ type: 'text', text: 'What is the password? Ask the custodian' }],
|
|
83
|
-
},
|
|
84
|
-
]);
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
const stream1 = await client.exec({
|
|
88
|
-
model: DEFAULT_EDGE_MODEL,
|
|
89
|
-
spaceId,
|
|
90
|
-
threadId,
|
|
91
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
92
|
-
tools: [custodian],
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
for await (const event of stream1) {
|
|
96
|
-
log('event', event);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// TODO(burdon): !!!
|
|
100
|
-
await stream1.complete();
|
|
101
|
-
const messages: Message[] = [];
|
|
102
|
-
|
|
103
|
-
const [message1] = messages;
|
|
104
|
-
log('full message', { message: message1 });
|
|
105
|
-
await client.appendMessages([message1]);
|
|
106
|
-
|
|
107
|
-
const toolUse = message1.content.find(({ type }) => type === 'tool_use')!;
|
|
108
|
-
invariant(toolUse.type === 'tool_use');
|
|
109
|
-
await client.appendMessages([
|
|
110
|
-
{
|
|
111
|
-
id: ObjectId.random(),
|
|
112
|
-
spaceId,
|
|
113
|
-
threadId,
|
|
114
|
-
role: 'user',
|
|
115
|
-
content: [{ type: 'tool_result', toolUseId: toolUse.id, content: 'password="The sky is blue"' }],
|
|
116
|
-
},
|
|
117
|
-
]);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
const stream2 = await client.exec({
|
|
122
|
-
model: DEFAULT_EDGE_MODEL,
|
|
123
|
-
spaceId,
|
|
124
|
-
threadId,
|
|
125
|
-
systemPrompt: 'You are a helpful assistant.',
|
|
126
|
-
tools: [custodian],
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
for await (const event of stream2) {
|
|
130
|
-
log('event', event);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
await stream2.complete();
|
|
134
|
-
const messages: Message[] = [];
|
|
135
|
-
|
|
136
|
-
const [message2] = messages;
|
|
137
|
-
log('full message', { message: message2 });
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test.skip('image generation', async () => {
|
|
142
|
-
const client = new AIServiceEdgeClient({
|
|
143
|
-
endpoint: AI_SERVICE_ENDPOINT.LOCAL,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
const spaceId = SpaceId.random();
|
|
147
|
-
const threadId = ObjectId.random();
|
|
148
|
-
|
|
149
|
-
await client.appendMessages([
|
|
150
|
-
{
|
|
151
|
-
id: ObjectId.random(),
|
|
152
|
-
spaceId,
|
|
153
|
-
threadId,
|
|
154
|
-
role: 'user',
|
|
155
|
-
content: [{ type: 'text', text: 'Generate an image of a cat' }],
|
|
156
|
-
},
|
|
157
|
-
]);
|
|
158
|
-
|
|
159
|
-
const stream = await client.exec({
|
|
160
|
-
model: DEFAULT_EDGE_MODEL,
|
|
161
|
-
spaceId,
|
|
162
|
-
threadId,
|
|
163
|
-
tools: [
|
|
164
|
-
{
|
|
165
|
-
name: 'text-to-image',
|
|
166
|
-
type: ToolTypes.TextToImage,
|
|
167
|
-
// options: {
|
|
168
|
-
// model: '@cf/stabilityai/stable-diffusion-xl-base-1.0',
|
|
169
|
-
// },
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
for await (const event of stream) {
|
|
175
|
-
log('event', event);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
log('full message', { message: await stream.complete() });
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
describe.skip('Ollama Client', () => {
|
|
183
|
-
test('basic', async (ctx) => {
|
|
184
|
-
const isRunning = await OllamaClient.isRunning();
|
|
185
|
-
if (!isRunning) {
|
|
186
|
-
ctx.skip();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const client = createTestOllamaClient();
|
|
190
|
-
const parser = new MixedStreamParser();
|
|
191
|
-
|
|
192
|
-
const messages = await parser.parse(
|
|
193
|
-
await client.exec({
|
|
194
|
-
prompt: createStatic(Message, {
|
|
195
|
-
role: 'user',
|
|
196
|
-
content: [{ type: 'text', text: 'Hello, world!' }],
|
|
197
|
-
}),
|
|
198
|
-
}),
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
log('messages', { messages });
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('tool calls', async (ctx) => {
|
|
205
|
-
const isRunning = await OllamaClient.isRunning();
|
|
206
|
-
if (!isRunning) {
|
|
207
|
-
ctx.skip();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const client = createTestOllamaClient({
|
|
211
|
-
tools: [
|
|
212
|
-
defineTool('test', {
|
|
213
|
-
name: 'encrypt',
|
|
214
|
-
description: 'Encrypt a message',
|
|
215
|
-
schema: S.Struct({
|
|
216
|
-
message: S.String.annotations({ description: 'The message to encrypt' }),
|
|
217
|
-
}),
|
|
218
|
-
execute: async ({ message }) => ToolResult.Success(message.split('').reverse().join('')),
|
|
219
|
-
}),
|
|
220
|
-
],
|
|
221
|
-
});
|
|
222
|
-
const parser = new MixedStreamParser();
|
|
223
|
-
parser.streamEvent.on((event) => {
|
|
224
|
-
// log('event', { event });
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
const messages = await parser.parse(
|
|
228
|
-
await client.exec({
|
|
229
|
-
prompt: createStatic(Message, {
|
|
230
|
-
role: 'user',
|
|
231
|
-
content: [{ type: 'text', text: 'What is the encrypted message for "Hello, world!"' }],
|
|
232
|
-
}),
|
|
233
|
-
}),
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
log('messages', { messages });
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
test('text-to-image', async (ctx) => {
|
|
240
|
-
const isRunning = await OllamaClient.isRunning();
|
|
241
|
-
if (!isRunning) {
|
|
242
|
-
ctx.skip();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const client = createTestOllamaClient();
|
|
246
|
-
const parser = new MixedStreamParser();
|
|
247
|
-
|
|
248
|
-
const messages = await parser.parse(
|
|
249
|
-
await client.exec({
|
|
250
|
-
prompt: createStatic(Message, {
|
|
251
|
-
role: 'user',
|
|
252
|
-
content: [{ type: 'text', text: 'Generate an image of a cat' }],
|
|
253
|
-
}),
|
|
254
|
-
tools: [
|
|
255
|
-
{
|
|
256
|
-
name: 'text-to-image',
|
|
257
|
-
type: ToolTypes.TextToImage,
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
}),
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
log('messages', { messages });
|
|
264
|
-
});
|
|
265
|
-
});
|
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;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema as S } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Message } from '@dxos/artifact';
|
|
8
|
-
import { assertArgument, invariant } from '@dxos/invariant';
|
|
9
|
-
import { log } from '@dxos/log';
|
|
10
|
-
|
|
11
|
-
import type { AIServiceClient, GenerationStream } from './service';
|
|
12
|
-
import { createGenerationStream } from './stream';
|
|
13
|
-
import { type GenerateRequest } from './types';
|
|
14
|
-
|
|
15
|
-
export type AIServiceEdgeClientOptions = {
|
|
16
|
-
endpoint: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class AIServiceEdgeClient implements AIServiceClient {
|
|
20
|
-
private readonly _endpoint: string;
|
|
21
|
-
|
|
22
|
-
constructor({ endpoint }: AIServiceEdgeClientOptions) {
|
|
23
|
-
invariant(endpoint, 'endpoint is required');
|
|
24
|
-
this._endpoint = endpoint;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated
|
|
29
|
-
*/
|
|
30
|
-
// TODO(burdon): Remove.
|
|
31
|
-
async appendMessages(messages: Message[]): Promise<void> {
|
|
32
|
-
const url = `${this._endpoint}/message`;
|
|
33
|
-
const res = await fetch(url, {
|
|
34
|
-
method: 'POST',
|
|
35
|
-
headers: { 'Content-Type': 'application/json' },
|
|
36
|
-
body: JSON.stringify({
|
|
37
|
-
messages: await S.encodePromise(S.Array(Message))(messages),
|
|
38
|
-
}),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (!res.ok) {
|
|
42
|
-
throw new Error(`${await res.text()} [${url}]`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Process request and open message stream.
|
|
48
|
-
*/
|
|
49
|
-
async exec(request: GenerateRequest): Promise<GenerationStream> {
|
|
50
|
-
assertArgument(typeof request.model === 'string', 'model is required');
|
|
51
|
-
log('requesting', { endpoint: this._endpoint });
|
|
52
|
-
const controller = new AbortController();
|
|
53
|
-
const response = await fetch(`${this._endpoint}/generate`, {
|
|
54
|
-
signal: controller.signal,
|
|
55
|
-
method: 'POST',
|
|
56
|
-
headers: { 'Content-Type': 'application/json' },
|
|
57
|
-
body: JSON.stringify({
|
|
58
|
-
// TODO(dmaretskyi): Errors if tools are not provided.
|
|
59
|
-
tools: request.tools ?? [],
|
|
60
|
-
...request,
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
invariant(response.body instanceof ReadableStream);
|
|
65
|
-
return createGenerationStream(response, controller);
|
|
66
|
-
}
|
|
67
|
-
}
|
package/src/ai-service/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
export * from './defs';
|
|
6
|
-
export * from './edge-client';
|
|
7
|
-
export * from './message-collector';
|
|
8
|
-
export * from './ollama-client';
|
|
9
|
-
export * from './parser';
|
|
10
|
-
export * from './service';
|
|
11
|
-
export * from './stream';
|
|
12
|
-
export * from './transform';
|
|
13
|
-
export * from './types';
|