@merit-systems/echo-react-sdk 1.0.10 → 1.0.12

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/index.d.ts CHANGED
@@ -1,15 +1,40 @@
1
1
  import { Balance } from '@merit-systems/echo-typescript-sdk';
2
+ import { ChatTransport } from 'ai';
2
3
  import { default as default_2 } from 'react';
4
+ import { EchoAnthropicProvider } from '@merit-systems/echo-typescript-sdk';
3
5
  import { EchoClient } from '@merit-systems/echo-typescript-sdk';
6
+ import { EchoConfig as EchoConfig_2 } from '@merit-systems/echo-typescript-sdk';
4
7
  import { EchoContextValue as EchoContextValue_2 } from '..';
8
+ import { EchoGoogleProvider } from '@merit-systems/echo-typescript-sdk';
9
+ import { EchoOpenAIProvider } from '@merit-systems/echo-typescript-sdk';
5
10
  import { FreeBalance } from '@merit-systems/echo-typescript-sdk';
6
11
  import { JSX as JSX_2 } from 'react/jsx-runtime';
12
+ import { ModelMessage } from 'ai';
7
13
  import { OpenAI as OpenAI_2 } from 'openai';
8
14
  import { ReactNode } from 'react';
15
+ import { UIDataTypes } from 'ai';
16
+ import { UIMessage } from 'ai';
17
+ import { UIMessageChunk } from 'ai';
18
+ import { UITools } from 'ai';
19
+ import { UseChatHelpers } from '@ai-sdk/react';
9
20
  import { User } from 'oidc-client-ts';
10
21
 
22
+ declare type ChatSendParams = Parameters<ChatTransport<UIMessage>['sendMessages']>[0];
23
+
11
24
  export declare type EchoBalance = Balance;
12
25
 
26
+ declare type EchoChatBuildContext = Pick<ChatSendParams, 'trigger' | 'chatId' | 'messageId' | 'abortSignal'> & {
27
+ uiMessages: UIMessage[];
28
+ modelMessages: ModelMessage[];
29
+ };
30
+
31
+ declare type EchoChatFn = (ctx: EchoChatBuildContext) => Promise<ReadableStream<UIMessageChunk>> | ReadableStream<UIMessageChunk>;
32
+
33
+ export declare function EchoChatProvider({ chatFn, children, }: {
34
+ chatFn: EchoChatFn;
35
+ children: React.ReactNode;
36
+ }): JSX_2.Element;
37
+
13
38
  export declare interface EchoConfig {
14
39
  appId: string;
15
40
  apiUrl?: string;
@@ -33,6 +58,7 @@ export declare interface EchoContextValue {
33
58
  createPaymentLink: (amount: number, description?: string, successUrl?: string) => Promise<string>;
34
59
  getToken: () => Promise<string | null>;
35
60
  clearAuth: () => Promise<void>;
61
+ config: EchoConfig_2;
36
62
  }
37
63
 
38
64
  export declare function EchoProvider({ config, children }: EchoProviderProps): JSX_2.Element | null;
@@ -79,6 +105,8 @@ declare interface LogoProps {
79
105
 
80
106
  declare type OpenAI = OpenAI_2;
81
107
 
108
+ export declare function useChat(): UseChatHelpers<UIMessage<unknown, UIDataTypes, UITools>>;
109
+
82
110
  export declare function useEcho(): EchoContextValue_2;
83
111
 
84
112
  /**
@@ -91,6 +119,12 @@ declare interface UseEchoClientOptions {
91
119
  apiUrl: string;
92
120
  }
93
121
 
122
+ export declare const useEchoModelProviders: () => {
123
+ openai: EchoOpenAIProvider;
124
+ anthropic: EchoAnthropicProvider;
125
+ google: EchoGoogleProvider;
126
+ };
127
+
94
128
  export declare function useEchoOpenAI(options?: UseEchoOpenAIOptions): UseEchoOpenAIResult;
95
129
 
96
130
  declare interface UseEchoOpenAIOptions {