@contractspec/integration.providers-impls 1.57.0 → 1.59.0
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/analytics.d.ts +1 -8
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +3 -3
- package/dist/calendar.d.ts +1 -8
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +3 -3
- package/dist/database.d.ts +1 -8
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +3 -3
- package/dist/email.d.ts +1 -8
- package/dist/email.d.ts.map +1 -1
- package/dist/email.js +3 -3
- package/dist/embedding.d.ts +1 -8
- package/dist/embedding.d.ts.map +1 -1
- package/dist/embedding.js +3 -3
- package/dist/impls/elevenlabs-voice.d.ts +14 -18
- package/dist/impls/elevenlabs-voice.d.ts.map +1 -1
- package/dist/impls/elevenlabs-voice.js +98 -88
- package/dist/impls/fal-voice.d.ts +22 -26
- package/dist/impls/fal-voice.d.ts.map +1 -1
- package/dist/impls/fal-voice.js +103 -78
- package/dist/impls/fathom-meeting-recorder.d.ts +35 -39
- package/dist/impls/fathom-meeting-recorder.d.ts.map +1 -1
- package/dist/impls/fathom-meeting-recorder.js +285 -142
- package/dist/impls/fathom-meeting-recorder.mapper.d.ts +4 -8
- package/dist/impls/fathom-meeting-recorder.mapper.d.ts.map +1 -1
- package/dist/impls/fathom-meeting-recorder.mapper.js +102 -38
- package/dist/impls/fathom-meeting-recorder.types.d.ts +16 -20
- package/dist/impls/fathom-meeting-recorder.types.d.ts.map +1 -1
- package/dist/impls/fathom-meeting-recorder.types.js +1 -0
- package/dist/impls/fathom-meeting-recorder.utils.d.ts +10 -14
- package/dist/impls/fathom-meeting-recorder.utils.d.ts.map +1 -1
- package/dist/impls/fathom-meeting-recorder.utils.js +58 -41
- package/dist/impls/fathom-meeting-recorder.webhooks.d.ts +3 -7
- package/dist/impls/fathom-meeting-recorder.webhooks.d.ts.map +1 -1
- package/dist/impls/fathom-meeting-recorder.webhooks.js +25 -20
- package/dist/impls/fireflies-meeting-recorder.d.ts +21 -25
- package/dist/impls/fireflies-meeting-recorder.d.ts.map +1 -1
- package/dist/impls/fireflies-meeting-recorder.js +272 -149
- package/dist/impls/fireflies-meeting-recorder.queries.d.ts +3 -6
- package/dist/impls/fireflies-meeting-recorder.queries.d.ts.map +1 -1
- package/dist/impls/fireflies-meeting-recorder.queries.js +10 -8
- package/dist/impls/fireflies-meeting-recorder.types.d.ts +26 -29
- package/dist/impls/fireflies-meeting-recorder.types.d.ts.map +1 -1
- package/dist/impls/fireflies-meeting-recorder.types.js +1 -0
- package/dist/impls/fireflies-meeting-recorder.utils.d.ts +4 -7
- package/dist/impls/fireflies-meeting-recorder.utils.d.ts.map +1 -1
- package/dist/impls/fireflies-meeting-recorder.utils.js +34 -27
- package/dist/impls/gcs-storage.d.ts +18 -22
- package/dist/impls/gcs-storage.d.ts.map +1 -1
- package/dist/impls/gcs-storage.js +92 -84
- package/dist/impls/gmail-inbound.d.ts +20 -24
- package/dist/impls/gmail-inbound.d.ts.map +1 -1
- package/dist/impls/gmail-inbound.js +212 -185
- package/dist/impls/gmail-outbound.d.ts +12 -16
- package/dist/impls/gmail-outbound.d.ts.map +1 -1
- package/dist/impls/gmail-outbound.js +126 -92
- package/dist/impls/google-calendar.d.ts +17 -21
- package/dist/impls/google-calendar.d.ts.map +1 -1
- package/dist/impls/google-calendar.js +182 -145
- package/dist/impls/gradium-voice.d.ts +20 -22
- package/dist/impls/gradium-voice.d.ts.map +1 -1
- package/dist/impls/gradium-voice.js +85 -74
- package/dist/impls/granola-meeting-recorder.d.ts +31 -24
- package/dist/impls/granola-meeting-recorder.d.ts.map +1 -1
- package/dist/impls/granola-meeting-recorder.js +511 -143
- package/dist/impls/granola-meeting-recorder.mcp.d.ts +25 -0
- package/dist/impls/granola-meeting-recorder.mcp.d.ts.map +1 -0
- package/dist/impls/granola-meeting-recorder.mcp.js +279 -0
- package/dist/impls/granola-meeting-recorder.types.d.ts +60 -49
- package/dist/impls/granola-meeting-recorder.types.d.ts.map +1 -1
- package/dist/impls/granola-meeting-recorder.types.js +1 -0
- package/dist/impls/index.d.ts +28 -28
- package/dist/impls/index.d.ts.map +1 -0
- package/dist/impls/index.js +4659 -29
- package/dist/impls/jira.d.ts +18 -22
- package/dist/impls/jira.d.ts.map +1 -1
- package/dist/impls/jira.js +112 -101
- package/dist/impls/linear.d.ts +17 -21
- package/dist/impls/linear.d.ts.map +1 -1
- package/dist/impls/linear.js +78 -69
- package/dist/impls/mistral-embedding.d.ts +17 -21
- package/dist/impls/mistral-embedding.d.ts.map +1 -1
- package/dist/impls/mistral-embedding.js +41 -39
- package/dist/impls/mistral-llm.d.ts +25 -29
- package/dist/impls/mistral-llm.d.ts.map +1 -1
- package/dist/impls/mistral-llm.js +266 -244
- package/dist/impls/notion.d.ts +20 -24
- package/dist/impls/notion.d.ts.map +1 -1
- package/dist/impls/notion.js +145 -110
- package/dist/impls/posthog-reader.d.ts +18 -22
- package/dist/impls/posthog-reader.d.ts.map +1 -1
- package/dist/impls/posthog-reader.js +148 -129
- package/dist/impls/posthog-utils.d.ts +4 -7
- package/dist/impls/posthog-utils.d.ts.map +1 -1
- package/dist/impls/posthog-utils.js +31 -22
- package/dist/impls/posthog.d.ts +33 -37
- package/dist/impls/posthog.d.ts.map +1 -1
- package/dist/impls/posthog.js +320 -119
- package/dist/impls/postmark-email.d.ts +13 -17
- package/dist/impls/postmark-email.d.ts.map +1 -1
- package/dist/impls/postmark-email.js +55 -50
- package/dist/impls/powens-client.d.ts +111 -114
- package/dist/impls/powens-client.d.ts.map +1 -1
- package/dist/impls/powens-client.js +194 -170
- package/dist/impls/powens-openbanking.d.ts +22 -26
- package/dist/impls/powens-openbanking.d.ts.map +1 -1
- package/dist/impls/powens-openbanking.js +425 -217
- package/dist/impls/provider-factory.d.ts +29 -33
- package/dist/impls/provider-factory.d.ts.map +1 -1
- package/dist/impls/provider-factory.js +4072 -275
- package/dist/impls/qdrant-vector.d.ts +18 -22
- package/dist/impls/qdrant-vector.d.ts.map +1 -1
- package/dist/impls/qdrant-vector.js +76 -69
- package/dist/impls/stripe-payments.d.ts +22 -26
- package/dist/impls/stripe-payments.d.ts.map +1 -1
- package/dist/impls/stripe-payments.js +219 -193
- package/dist/impls/supabase-psql.d.ts +21 -25
- package/dist/impls/supabase-psql.d.ts.map +1 -1
- package/dist/impls/supabase-psql.js +138 -98
- package/dist/impls/supabase-vector.d.ts +29 -33
- package/dist/impls/supabase-vector.d.ts.map +1 -1
- package/dist/impls/supabase-vector.js +278 -103
- package/dist/impls/tldv-meeting-recorder.d.ts +18 -22
- package/dist/impls/tldv-meeting-recorder.d.ts.map +1 -1
- package/dist/impls/tldv-meeting-recorder.js +142 -127
- package/dist/impls/twilio-sms.d.ts +14 -17
- package/dist/impls/twilio-sms.d.ts.map +1 -1
- package/dist/impls/twilio-sms.js +62 -55
- package/dist/index.d.ts +15 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4700 -107
- package/dist/llm.d.ts +1 -8
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +3 -3
- package/dist/meeting-recorder.d.ts +1 -8
- package/dist/meeting-recorder.d.ts.map +1 -1
- package/dist/meeting-recorder.js +3 -3
- package/dist/node/analytics.js +2 -0
- package/dist/node/calendar.js +2 -0
- package/dist/node/database.js +2 -0
- package/dist/node/email.js +2 -0
- package/dist/node/embedding.js +2 -0
- package/dist/node/impls/elevenlabs-voice.js +102 -0
- package/dist/node/impls/fal-voice.js +112 -0
- package/dist/node/impls/fathom-meeting-recorder.js +287 -0
- package/dist/node/impls/fathom-meeting-recorder.mapper.js +105 -0
- package/dist/node/impls/fathom-meeting-recorder.types.js +0 -0
- package/dist/node/impls/fathom-meeting-recorder.utils.js +72 -0
- package/dist/node/impls/fathom-meeting-recorder.webhooks.js +29 -0
- package/dist/node/impls/fireflies-meeting-recorder.js +274 -0
- package/dist/node/impls/fireflies-meeting-recorder.queries.js +85 -0
- package/dist/node/impls/fireflies-meeting-recorder.types.js +0 -0
- package/dist/node/impls/fireflies-meeting-recorder.utils.js +42 -0
- package/dist/node/impls/gcs-storage.js +97 -0
- package/dist/node/impls/gmail-inbound.js +227 -0
- package/dist/node/impls/gmail-outbound.js +139 -0
- package/dist/node/impls/google-calendar.js +191 -0
- package/dist/node/impls/gradium-voice.js +90 -0
- package/dist/node/impls/granola-meeting-recorder.js +512 -0
- package/dist/node/impls/granola-meeting-recorder.mcp.js +278 -0
- package/dist/node/impls/granola-meeting-recorder.types.js +0 -0
- package/dist/node/impls/index.js +4658 -0
- package/dist/node/impls/jira.js +124 -0
- package/dist/node/impls/linear.js +83 -0
- package/dist/node/impls/mistral-embedding.js +43 -0
- package/dist/node/impls/mistral-llm.js +269 -0
- package/dist/node/impls/notion.js +160 -0
- package/dist/node/impls/posthog-reader.js +159 -0
- package/dist/node/impls/posthog-utils.js +38 -0
- package/dist/node/impls/posthog.js +322 -0
- package/dist/node/impls/postmark-email.js +60 -0
- package/dist/node/impls/powens-client.js +195 -0
- package/dist/node/impls/powens-openbanking.js +426 -0
- package/dist/node/impls/provider-factory.js +4080 -0
- package/dist/node/impls/qdrant-vector.js +78 -0
- package/dist/node/impls/stripe-payments.js +228 -0
- package/dist/node/impls/supabase-psql.js +150 -0
- package/dist/node/impls/supabase-vector.js +323 -0
- package/dist/node/impls/tldv-meeting-recorder.js +145 -0
- package/dist/node/impls/twilio-sms.js +65 -0
- package/dist/node/index.js +4699 -0
- package/dist/node/llm.js +2 -0
- package/dist/node/meeting-recorder.js +2 -0
- package/dist/node/openbanking.js +2 -0
- package/dist/node/payments.js +2 -0
- package/dist/node/project-management.js +2 -0
- package/dist/node/runtime.js +0 -0
- package/dist/node/secrets/provider.js +11 -0
- package/dist/node/sms.js +2 -0
- package/dist/node/storage.js +2 -0
- package/dist/node/vector-store.js +2 -0
- package/dist/node/voice.js +2 -0
- package/dist/openbanking.d.ts +1 -8
- package/dist/openbanking.d.ts.map +1 -1
- package/dist/openbanking.js +3 -3
- package/dist/payments.d.ts +1 -8
- package/dist/payments.d.ts.map +1 -1
- package/dist/payments.js +3 -3
- package/dist/project-management.d.ts +1 -8
- package/dist/project-management.d.ts.map +1 -1
- package/dist/project-management.js +3 -3
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/secrets/provider.d.ts +3 -2
- package/dist/secrets/provider.d.ts.map +1 -0
- package/dist/secrets/provider.js +12 -3
- package/dist/sms.d.ts +1 -8
- package/dist/sms.d.ts.map +1 -1
- package/dist/sms.js +3 -3
- package/dist/storage.d.ts +1 -8
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +3 -3
- package/dist/vector-store.d.ts +1 -8
- package/dist/vector-store.d.ts.map +1 -1
- package/dist/vector-store.js +3 -3
- package/dist/voice.d.ts +1 -8
- package/dist/voice.d.ts.map +1 -1
- package/dist/voice.js +3 -3
- package/package.json +405 -114
- package/dist/_virtual/_rolldown/runtime.js +0 -36
- package/dist/impls/elevenlabs-voice.js.map +0 -1
- package/dist/impls/fal-voice.js.map +0 -1
- package/dist/impls/fathom-meeting-recorder.js.map +0 -1
- package/dist/impls/fathom-meeting-recorder.mapper.js.map +0 -1
- package/dist/impls/fathom-meeting-recorder.utils.js.map +0 -1
- package/dist/impls/fathom-meeting-recorder.webhooks.js.map +0 -1
- package/dist/impls/fireflies-meeting-recorder.js.map +0 -1
- package/dist/impls/fireflies-meeting-recorder.queries.js.map +0 -1
- package/dist/impls/fireflies-meeting-recorder.utils.js.map +0 -1
- package/dist/impls/gcs-storage.js.map +0 -1
- package/dist/impls/gmail-inbound.js.map +0 -1
- package/dist/impls/gmail-outbound.js.map +0 -1
- package/dist/impls/google-calendar.js.map +0 -1
- package/dist/impls/gradium-voice.js.map +0 -1
- package/dist/impls/granola-meeting-recorder.js.map +0 -1
- package/dist/impls/jira.js.map +0 -1
- package/dist/impls/linear.js.map +0 -1
- package/dist/impls/mistral-embedding.js.map +0 -1
- package/dist/impls/mistral-llm.js.map +0 -1
- package/dist/impls/notion.js.map +0 -1
- package/dist/impls/posthog-reader.js.map +0 -1
- package/dist/impls/posthog-utils.js.map +0 -1
- package/dist/impls/posthog.js.map +0 -1
- package/dist/impls/postmark-email.js.map +0 -1
- package/dist/impls/powens-client.js.map +0 -1
- package/dist/impls/powens-openbanking.js.map +0 -1
- package/dist/impls/provider-factory.js.map +0 -1
- package/dist/impls/qdrant-vector.js.map +0 -1
- package/dist/impls/stripe-payments.js.map +0 -1
- package/dist/impls/supabase-psql.js.map +0 -1
- package/dist/impls/supabase-vector.js.map +0 -1
- package/dist/impls/tldv-meeting-recorder.js.map +0 -1
- package/dist/impls/twilio-sms.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
client?: Mistral;
|
|
10
|
-
userAgentSuffix?: string;
|
|
1
|
+
import { Mistral } from '@mistralai/mistralai';
|
|
2
|
+
import type { LLMChatOptions, LLMMessage, LLMProvider, LLMResponse, LLMStreamChunk } from '../llm';
|
|
3
|
+
export interface MistralLLMProviderOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
defaultModel?: string;
|
|
6
|
+
serverURL?: string;
|
|
7
|
+
client?: Mistral;
|
|
8
|
+
userAgentSuffix?: string;
|
|
11
9
|
}
|
|
12
|
-
declare class MistralLLMProvider implements
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
10
|
+
export declare class MistralLLMProvider implements LLMProvider {
|
|
11
|
+
private readonly client;
|
|
12
|
+
private readonly defaultModel;
|
|
13
|
+
constructor(options: MistralLLMProviderOptions);
|
|
14
|
+
chat(messages: LLMMessage[], options?: LLMChatOptions): Promise<LLMResponse>;
|
|
15
|
+
stream(messages: LLMMessage[], options?: LLMChatOptions): AsyncIterable<LLMStreamChunk>;
|
|
16
|
+
countTokens(_messages: LLMMessage[]): Promise<{
|
|
17
|
+
promptTokens: number;
|
|
18
|
+
}>;
|
|
19
|
+
private buildChatRequest;
|
|
20
|
+
private buildLLMResponse;
|
|
21
|
+
private fromUsage;
|
|
22
|
+
private fromAssistantMessage;
|
|
23
|
+
private fromMistralToolCall;
|
|
24
|
+
private toMistralMessage;
|
|
25
|
+
private extractText;
|
|
26
|
+
private extractToolCalls;
|
|
29
27
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { MistralLLMProvider, MistralLLMProviderOptions };
|
|
32
28
|
//# sourceMappingURL=mistral-llm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mistral-llm.d.ts","
|
|
1
|
+
{"version":3,"file":"mistral-llm.d.ts","sourceRoot":"","sources":["../../src/impls/mistral-llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,KAAK,EACV,cAAc,EAEd,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,EAGf,MAAM,QAAQ,CAAC;AAEhB,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,EAAE,yBAAyB;IAiBxC,IAAI,CACR,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC;IAMhB,MAAM,CACX,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,GAAE,cAAmB,GAC3B,aAAa,CAAC,cAAc,CAAC;IAsF1B,WAAW,CACf,SAAS,EAAE,UAAU,EAAE,GACtB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpC,OAAO,CAAC,gBAAgB;IAiDxB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,oBAAoB;IAiC5B,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,gBAAgB;CAczB"}
|
|
@@ -1,248 +1,270 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/impls/mistral-llm.ts
|
|
1
3
|
import { Mistral } from "@mistralai/mistralai";
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
5
|
+
class MistralLLMProvider {
|
|
6
|
+
client;
|
|
7
|
+
defaultModel;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
if (!options.apiKey) {
|
|
10
|
+
throw new Error("MistralLLMProvider requires an apiKey");
|
|
11
|
+
}
|
|
12
|
+
this.client = options.client ?? new Mistral({
|
|
13
|
+
apiKey: options.apiKey,
|
|
14
|
+
serverURL: options.serverURL,
|
|
15
|
+
userAgent: options.userAgentSuffix ? `${options.userAgentSuffix}` : undefined
|
|
16
|
+
});
|
|
17
|
+
this.defaultModel = options.defaultModel ?? "mistral-large-latest";
|
|
18
|
+
}
|
|
19
|
+
async chat(messages, options = {}) {
|
|
20
|
+
const request = this.buildChatRequest(messages, options);
|
|
21
|
+
const response = await this.client.chat.complete(request);
|
|
22
|
+
return this.buildLLMResponse(response);
|
|
23
|
+
}
|
|
24
|
+
async* stream(messages, options = {}) {
|
|
25
|
+
const request = this.buildChatRequest(messages, options);
|
|
26
|
+
request.stream = true;
|
|
27
|
+
const stream = await this.client.chat.stream(request);
|
|
28
|
+
const aggregatedParts = [];
|
|
29
|
+
const aggregatedToolCalls = [];
|
|
30
|
+
let usage;
|
|
31
|
+
let finishReason;
|
|
32
|
+
for await (const event of stream) {
|
|
33
|
+
for (const choice of event.data.choices) {
|
|
34
|
+
const delta = choice.delta;
|
|
35
|
+
if (typeof delta.content === "string") {
|
|
36
|
+
if (delta.content.length > 0) {
|
|
37
|
+
aggregatedParts.push({ type: "text", text: delta.content });
|
|
38
|
+
yield {
|
|
39
|
+
type: "message_delta",
|
|
40
|
+
delta: { type: "text", text: delta.content },
|
|
41
|
+
index: choice.index
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
} else if (Array.isArray(delta.content)) {
|
|
45
|
+
for (const chunk of delta.content) {
|
|
46
|
+
if (chunk.type === "text" && "text" in chunk) {
|
|
47
|
+
aggregatedParts.push({ type: "text", text: chunk.text });
|
|
48
|
+
yield {
|
|
49
|
+
type: "message_delta",
|
|
50
|
+
delta: { type: "text", text: chunk.text },
|
|
51
|
+
index: choice.index
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (delta.toolCalls) {
|
|
57
|
+
let localIndex = 0;
|
|
58
|
+
for (const call of delta.toolCalls) {
|
|
59
|
+
const toolCall = this.fromMistralToolCall(call, localIndex);
|
|
60
|
+
aggregatedToolCalls.push(toolCall);
|
|
61
|
+
yield {
|
|
62
|
+
type: "tool_call",
|
|
63
|
+
call: toolCall,
|
|
64
|
+
index: choice.index
|
|
65
|
+
};
|
|
66
|
+
localIndex += 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (choice.finishReason && choice.finishReason !== "null") {
|
|
70
|
+
finishReason = choice.finishReason;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (event.data.usage) {
|
|
74
|
+
const usageEntry = this.fromUsage(event.data.usage);
|
|
75
|
+
if (usageEntry) {
|
|
76
|
+
usage = usageEntry;
|
|
77
|
+
yield { type: "usage", usage: usageEntry };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const message = {
|
|
82
|
+
role: "assistant",
|
|
83
|
+
content: aggregatedParts.length ? aggregatedParts : [{ type: "text", text: "" }]
|
|
84
|
+
};
|
|
85
|
+
if (aggregatedToolCalls.length > 0) {
|
|
86
|
+
message.content = [
|
|
87
|
+
...aggregatedToolCalls,
|
|
88
|
+
...aggregatedParts.length ? aggregatedParts : []
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
yield {
|
|
92
|
+
type: "end",
|
|
93
|
+
response: {
|
|
94
|
+
message,
|
|
95
|
+
usage,
|
|
96
|
+
finishReason: mapFinishReason(finishReason)
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async countTokens(_messages) {
|
|
101
|
+
throw new Error("Mistral API does not currently support token counting");
|
|
102
|
+
}
|
|
103
|
+
buildChatRequest(messages, options) {
|
|
104
|
+
const model = options.model ?? this.defaultModel;
|
|
105
|
+
const mappedMessages = messages.map((message) => this.toMistralMessage(message));
|
|
106
|
+
const request = {
|
|
107
|
+
model,
|
|
108
|
+
messages: mappedMessages
|
|
109
|
+
};
|
|
110
|
+
if (options.temperature != null) {
|
|
111
|
+
request.temperature = options.temperature;
|
|
112
|
+
}
|
|
113
|
+
if (options.topP != null) {
|
|
114
|
+
request.topP = options.topP;
|
|
115
|
+
}
|
|
116
|
+
if (options.maxOutputTokens != null) {
|
|
117
|
+
request.maxTokens = options.maxOutputTokens;
|
|
118
|
+
}
|
|
119
|
+
if (options.stopSequences?.length) {
|
|
120
|
+
request.stop = options.stopSequences.length === 1 ? options.stopSequences[0] : options.stopSequences;
|
|
121
|
+
}
|
|
122
|
+
if (options.tools?.length) {
|
|
123
|
+
request.tools = options.tools.map((tool) => ({
|
|
124
|
+
type: "function",
|
|
125
|
+
function: {
|
|
126
|
+
name: tool.name,
|
|
127
|
+
description: tool.description,
|
|
128
|
+
parameters: typeof tool.inputSchema === "object" && tool.inputSchema !== null ? tool.inputSchema : {}
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
if (options.responseFormat === "json") {
|
|
133
|
+
request.responseFormat = { type: "json_object" };
|
|
134
|
+
}
|
|
135
|
+
return request;
|
|
136
|
+
}
|
|
137
|
+
buildLLMResponse(response) {
|
|
138
|
+
const firstChoice = response.choices[0];
|
|
139
|
+
if (!firstChoice) {
|
|
140
|
+
return {
|
|
141
|
+
message: {
|
|
142
|
+
role: "assistant",
|
|
143
|
+
content: [{ type: "text", text: "" }]
|
|
144
|
+
},
|
|
145
|
+
usage: this.fromUsage(response.usage),
|
|
146
|
+
raw: response
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const message = this.fromAssistantMessage(firstChoice.message);
|
|
150
|
+
return {
|
|
151
|
+
message,
|
|
152
|
+
usage: this.fromUsage(response.usage),
|
|
153
|
+
finishReason: mapFinishReason(firstChoice.finishReason),
|
|
154
|
+
raw: response
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
fromUsage(usage) {
|
|
158
|
+
if (!usage)
|
|
159
|
+
return;
|
|
160
|
+
return {
|
|
161
|
+
promptTokens: usage.promptTokens ?? 0,
|
|
162
|
+
completionTokens: usage.completionTokens ?? 0,
|
|
163
|
+
totalTokens: usage.totalTokens ?? 0
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
fromAssistantMessage(message) {
|
|
167
|
+
const parts = [];
|
|
168
|
+
if (typeof message.content === "string") {
|
|
169
|
+
parts.push({ type: "text", text: message.content });
|
|
170
|
+
} else if (Array.isArray(message.content)) {
|
|
171
|
+
message.content.forEach((chunk) => {
|
|
172
|
+
if (chunk.type === "text" && "text" in chunk) {
|
|
173
|
+
parts.push({ type: "text", text: chunk.text });
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const toolCalls = message.toolCalls?.map((call, index) => this.fromMistralToolCall(call, index)) ?? [];
|
|
178
|
+
if (toolCalls.length > 0) {
|
|
179
|
+
parts.splice(0, 0, ...toolCalls);
|
|
180
|
+
}
|
|
181
|
+
if (parts.length === 0) {
|
|
182
|
+
parts.push({ type: "text", text: "" });
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
role: "assistant",
|
|
186
|
+
content: parts
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
fromMistralToolCall(call, index) {
|
|
190
|
+
const args = typeof call.function.arguments === "string" ? call.function.arguments : JSON.stringify(call.function.arguments);
|
|
191
|
+
return {
|
|
192
|
+
type: "tool-call",
|
|
193
|
+
id: call.id ?? `tool-call-${index}`,
|
|
194
|
+
name: call.function.name,
|
|
195
|
+
arguments: args
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
toMistralMessage(message) {
|
|
199
|
+
const textContent = this.extractText(message.content);
|
|
200
|
+
const toolCalls = this.extractToolCalls(message);
|
|
201
|
+
switch (message.role) {
|
|
202
|
+
case "system":
|
|
203
|
+
return {
|
|
204
|
+
role: "system",
|
|
205
|
+
content: textContent ?? ""
|
|
206
|
+
};
|
|
207
|
+
case "user":
|
|
208
|
+
return {
|
|
209
|
+
role: "user",
|
|
210
|
+
content: textContent ?? ""
|
|
211
|
+
};
|
|
212
|
+
case "assistant":
|
|
213
|
+
return {
|
|
214
|
+
role: "assistant",
|
|
215
|
+
content: toolCalls.length > 0 ? null : textContent ?? "",
|
|
216
|
+
toolCalls: toolCalls.length > 0 ? toolCalls : undefined
|
|
217
|
+
};
|
|
218
|
+
case "tool":
|
|
219
|
+
return {
|
|
220
|
+
role: "tool",
|
|
221
|
+
content: textContent ?? "",
|
|
222
|
+
toolCallId: message.toolCallId ?? toolCalls[0]?.id
|
|
223
|
+
};
|
|
224
|
+
default:
|
|
225
|
+
return {
|
|
226
|
+
role: "user",
|
|
227
|
+
content: textContent ?? ""
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
extractText(parts) {
|
|
232
|
+
const textParts = parts.filter((part) => part.type === "text").map((part) => part.text);
|
|
233
|
+
if (textParts.length === 0)
|
|
234
|
+
return null;
|
|
235
|
+
return textParts.join("");
|
|
236
|
+
}
|
|
237
|
+
extractToolCalls(message) {
|
|
238
|
+
const toolCallParts = message.content.filter((part) => part.type === "tool-call");
|
|
239
|
+
return toolCallParts.map((call, index) => ({
|
|
240
|
+
id: call.id ?? `call_${index}`,
|
|
241
|
+
type: "function",
|
|
242
|
+
index,
|
|
243
|
+
function: {
|
|
244
|
+
name: call.name,
|
|
245
|
+
arguments: call.arguments
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
234
250
|
function mapFinishReason(reason) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
251
|
+
if (!reason)
|
|
252
|
+
return;
|
|
253
|
+
const normalized = reason.toLowerCase();
|
|
254
|
+
switch (normalized) {
|
|
255
|
+
case "stop":
|
|
256
|
+
return "stop";
|
|
257
|
+
case "length":
|
|
258
|
+
return "length";
|
|
259
|
+
case "tool_call":
|
|
260
|
+
case "tool_calls":
|
|
261
|
+
return "tool_call";
|
|
262
|
+
case "content_filter":
|
|
263
|
+
return "content_filter";
|
|
264
|
+
default:
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
244
267
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
//# sourceMappingURL=mistral-llm.js.map
|
|
268
|
+
export {
|
|
269
|
+
MistralLLMProvider
|
|
270
|
+
};
|
package/dist/impls/notion.d.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
descriptionProperty?: string;
|
|
15
|
-
client?: Client;
|
|
1
|
+
import { Client } from '@notionhq/client';
|
|
2
|
+
import type { ProjectManagementProvider, ProjectManagementWorkItem, ProjectManagementWorkItemInput } from '../project-management';
|
|
3
|
+
export interface NotionProjectManagementProviderOptions {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
databaseId?: string;
|
|
6
|
+
summaryParentPageId?: string;
|
|
7
|
+
titleProperty?: string;
|
|
8
|
+
statusProperty?: string;
|
|
9
|
+
priorityProperty?: string;
|
|
10
|
+
tagsProperty?: string;
|
|
11
|
+
dueDateProperty?: string;
|
|
12
|
+
descriptionProperty?: string;
|
|
13
|
+
client?: Client;
|
|
16
14
|
}
|
|
17
|
-
declare class NotionProjectManagementProvider implements
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
export declare class NotionProjectManagementProvider implements ProjectManagementProvider {
|
|
16
|
+
private readonly client;
|
|
17
|
+
private readonly defaults;
|
|
18
|
+
constructor(options: NotionProjectManagementProviderOptions);
|
|
19
|
+
createWorkItem(input: ProjectManagementWorkItemInput): Promise<ProjectManagementWorkItem>;
|
|
20
|
+
createWorkItems(items: ProjectManagementWorkItemInput[]): Promise<ProjectManagementWorkItem[]>;
|
|
21
|
+
private createSummaryPage;
|
|
24
22
|
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { NotionProjectManagementProvider, NotionProjectManagementProviderOptions };
|
|
27
23
|
//# sourceMappingURL=notion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notion.d.ts","
|
|
1
|
+
{"version":3,"file":"notion.d.ts","sourceRoot":"","sources":["../../src/impls/notion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,sCAAsC;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwBD,qBAAa,+BAAgC,YAAW,yBAAyB;IAC/E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGvB;gBAEU,OAAO,EAAE,sCAAsC;IAcrD,cAAc,CAClB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,yBAAyB,CAAC;IA2C/B,eAAe,CACnB,KAAK,EAAE,8BAA8B,EAAE,GACtC,OAAO,CAAC,yBAAyB,EAAE,CAAC;YAQzB,iBAAiB;CAsChC"}
|