@langchain/google-common 2.0.3 → 2.0.4
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/CHANGELOG.md +7 -0
- package/dist/chat_models.d.cts +14 -2
- package/dist/chat_models.d.ts +14 -2
- package/dist/connection.d.cts +2 -0
- package/dist/connection.d.ts +2 -0
- package/dist/experimental/media.d.cts +7 -6
- package/dist/experimental/media.d.ts +7 -6
- package/dist/experimental/utils/media_core.d.cts +4 -3
- package/dist/experimental/utils/media_core.d.ts +4 -3
- package/dist/llms.d.cts +7 -0
- package/dist/llms.d.ts +7 -0
- package/dist/types-anthropic.d.cts +4 -1
- package/dist/types-anthropic.d.ts +4 -1
- package/dist/types.d.cts +24 -11
- package/dist/types.d.ts +24 -11
- package/dist/utils/failed_handler.d.cts +1 -0
- package/dist/utils/failed_handler.d.ts +1 -0
- package/dist/utils/palm.d.cts +1 -0
- package/dist/utils/palm.d.ts +1 -0
- package/dist/utils/safety.d.cts +1 -0
- package/dist/utils/safety.d.ts +1 -0
- package/dist/utils/stream.d.cts +21 -0
- package/dist/utils/stream.d.ts +21 -0
- package/dist/utils/zod_to_gemini_parameters.d.cts +14 -4
- package/dist/utils/zod_to_gemini_parameters.d.ts +14 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @langchain/google-common
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`0bade90`](https://github.com/langchain-ai/langchainjs/commit/0bade90ed47c7988ed86f1e695a28273c7b3df50), [`6c40d00`](https://github.com/langchain-ai/langchainjs/commit/6c40d00e926f377d249c2919549381522eac8ed1)]:
|
|
8
|
+
- @langchain/core@1.1.4
|
|
9
|
+
|
|
3
10
|
## 2.0.3
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/chat_models.d.cts
CHANGED
|
@@ -30,11 +30,13 @@ interface ChatGoogleBaseInput<AuthOptions> extends BaseChatModelParams, GoogleCo
|
|
|
30
30
|
* Integration with a Google chat model.
|
|
31
31
|
*/
|
|
32
32
|
declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleAIBaseLanguageModelCallOptions, AIMessageChunk> implements ChatGoogleBaseInput<AuthOptions> {
|
|
33
|
+
// Used for tracing, replace with the same name as your class
|
|
33
34
|
static lc_name(): string;
|
|
34
35
|
get lc_secrets(): {
|
|
35
36
|
[key: string]: string;
|
|
36
37
|
} | undefined;
|
|
37
38
|
lc_serializable: boolean;
|
|
39
|
+
// Set based on modelName
|
|
38
40
|
model: string;
|
|
39
41
|
modelName: string;
|
|
40
42
|
temperature: number;
|
|
@@ -50,6 +52,7 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
50
52
|
topLogprobs: number;
|
|
51
53
|
safetySettings: GoogleAISafetySetting[];
|
|
52
54
|
responseModalities?: GoogleAIModelModality[];
|
|
55
|
+
// May intentionally be undefined, meaning to compute this.
|
|
53
56
|
convertSystemMessageToHumanContent: boolean | undefined;
|
|
54
57
|
safetyHandler: GoogleAISafetyHandler;
|
|
55
58
|
speechConfig: GoogleSpeechConfig;
|
|
@@ -67,6 +70,7 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
67
70
|
buildConnection(fields: GoogleBaseLLMInput<AuthOptions>, client: GoogleAbstractedClient): void;
|
|
68
71
|
get platform(): GooglePlatformType;
|
|
69
72
|
bindTools(tools: GoogleAIToolType[], kwargs?: Partial<GoogleAIBaseLanguageModelCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleAIBaseLanguageModelCallOptions>;
|
|
73
|
+
// Replace
|
|
70
74
|
_llmType(): string;
|
|
71
75
|
/**
|
|
72
76
|
* Get the parameters used to invoke the model
|
|
@@ -86,8 +90,16 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
86
90
|
* @returns {ModelProfile} An object describing the model's capabilities and constraints
|
|
87
91
|
*/
|
|
88
92
|
get profile(): ModelProfile;
|
|
89
|
-
withStructuredOutput<
|
|
90
|
-
|
|
93
|
+
withStructuredOutput<
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
98
|
+
withStructuredOutput<
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
91
103
|
raw: BaseMessage;
|
|
92
104
|
parsed: RunOutput;
|
|
93
105
|
}>;
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -30,11 +30,13 @@ interface ChatGoogleBaseInput<AuthOptions> extends BaseChatModelParams, GoogleCo
|
|
|
30
30
|
* Integration with a Google chat model.
|
|
31
31
|
*/
|
|
32
32
|
declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleAIBaseLanguageModelCallOptions, AIMessageChunk> implements ChatGoogleBaseInput<AuthOptions> {
|
|
33
|
+
// Used for tracing, replace with the same name as your class
|
|
33
34
|
static lc_name(): string;
|
|
34
35
|
get lc_secrets(): {
|
|
35
36
|
[key: string]: string;
|
|
36
37
|
} | undefined;
|
|
37
38
|
lc_serializable: boolean;
|
|
39
|
+
// Set based on modelName
|
|
38
40
|
model: string;
|
|
39
41
|
modelName: string;
|
|
40
42
|
temperature: number;
|
|
@@ -50,6 +52,7 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
50
52
|
topLogprobs: number;
|
|
51
53
|
safetySettings: GoogleAISafetySetting[];
|
|
52
54
|
responseModalities?: GoogleAIModelModality[];
|
|
55
|
+
// May intentionally be undefined, meaning to compute this.
|
|
53
56
|
convertSystemMessageToHumanContent: boolean | undefined;
|
|
54
57
|
safetyHandler: GoogleAISafetyHandler;
|
|
55
58
|
speechConfig: GoogleSpeechConfig;
|
|
@@ -67,6 +70,7 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
67
70
|
buildConnection(fields: GoogleBaseLLMInput<AuthOptions>, client: GoogleAbstractedClient): void;
|
|
68
71
|
get platform(): GooglePlatformType;
|
|
69
72
|
bindTools(tools: GoogleAIToolType[], kwargs?: Partial<GoogleAIBaseLanguageModelCallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, GoogleAIBaseLanguageModelCallOptions>;
|
|
73
|
+
// Replace
|
|
70
74
|
_llmType(): string;
|
|
71
75
|
/**
|
|
72
76
|
* Get the parameters used to invoke the model
|
|
@@ -86,8 +90,16 @@ declare abstract class ChatGoogleBase<AuthOptions> extends BaseChatModel<GoogleA
|
|
|
86
90
|
* @returns {ModelProfile} An object describing the model's capabilities and constraints
|
|
87
91
|
*/
|
|
88
92
|
get profile(): ModelProfile;
|
|
89
|
-
withStructuredOutput<
|
|
90
|
-
|
|
93
|
+
withStructuredOutput<
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
98
|
+
withStructuredOutput<
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
91
103
|
raw: BaseMessage;
|
|
92
104
|
parsed: RunOutput;
|
|
93
105
|
}>;
|
package/dist/connection.d.cts
CHANGED
|
@@ -24,6 +24,8 @@ declare abstract class GoogleConnection<CallOptions extends AsyncCallerCallOptio
|
|
|
24
24
|
_request(data: unknown | undefined, options: CallOptions, requestHeaders?: Record<string, string>): Promise<ResponseType>;
|
|
25
25
|
}
|
|
26
26
|
declare abstract class GoogleHostConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse, AuthOptions> extends GoogleConnection<CallOptions, ResponseType> implements GoogleConnectionParams<AuthOptions> {
|
|
27
|
+
// This does not default to a value intentionally.
|
|
28
|
+
// Use the "platform" getter if you need this.
|
|
27
29
|
platformType: GooglePlatformType | undefined;
|
|
28
30
|
_endpoint: string | undefined;
|
|
29
31
|
_location: string | undefined;
|
package/dist/connection.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ declare abstract class GoogleConnection<CallOptions extends AsyncCallerCallOptio
|
|
|
24
24
|
_request(data: unknown | undefined, options: CallOptions, requestHeaders?: Record<string, string>): Promise<ResponseType>;
|
|
25
25
|
}
|
|
26
26
|
declare abstract class GoogleHostConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse, AuthOptions> extends GoogleConnection<CallOptions, ResponseType> implements GoogleConnectionParams<AuthOptions> {
|
|
27
|
+
// This does not default to a value intentionally.
|
|
28
|
+
// Use the "platform" getter if you need this.
|
|
27
29
|
platformType: GooglePlatformType | undefined;
|
|
28
30
|
_endpoint: string | undefined;
|
|
29
31
|
_location: string | undefined;
|
|
@@ -38,6 +38,7 @@ declare abstract class BlobStoreGoogle<ResponseType extends GoogleResponse, Auth
|
|
|
38
38
|
abstract buildDeleteConnection(key: string): GoogleDownloadConnection<AsyncCallerCallOptions, GoogleResponse, AuthOptions>;
|
|
39
39
|
_del(key: string): Promise<void>;
|
|
40
40
|
mdelete(keys: string[]): Promise<void>;
|
|
41
|
+
// eslint-disable-next-line require-yield
|
|
41
42
|
yieldKeys(_prefix: string | undefined): AsyncGenerator<string>;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -108,7 +109,7 @@ declare abstract class BlobStoreGoogleCloudStorageBase<AuthOptions> extends Blob
|
|
|
108
109
|
type AIStudioFileState = "PROCESSING" | "ACTIVE" | "FAILED" | "STATE_UNSPECIFIED";
|
|
109
110
|
type AIStudioFileVideoMetadata = {
|
|
110
111
|
videoMetadata: {
|
|
111
|
-
videoDuration: string;
|
|
112
|
+
videoDuration: string; // Duration in seconds, possibly with fractional, ending in "s"
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
type AIStudioFileMetadata = AIStudioFileVideoMetadata;
|
|
@@ -116,11 +117,11 @@ interface AIStudioFileObject {
|
|
|
116
117
|
name?: string;
|
|
117
118
|
displayName?: string;
|
|
118
119
|
mimeType?: string;
|
|
119
|
-
sizeBytes?: string;
|
|
120
|
-
createTime?: string;
|
|
121
|
-
updateTime?: string;
|
|
122
|
-
expirationTime?: string;
|
|
123
|
-
sha256Hash?: string;
|
|
120
|
+
sizeBytes?: string; // int64 format
|
|
121
|
+
createTime?: string; // timestamp format
|
|
122
|
+
updateTime?: string; // timestamp format
|
|
123
|
+
expirationTime?: string; // timestamp format
|
|
124
|
+
sha256Hash?: string; // base64 encoded
|
|
124
125
|
uri?: string;
|
|
125
126
|
state?: AIStudioFileState;
|
|
126
127
|
error?: {
|
|
@@ -38,6 +38,7 @@ declare abstract class BlobStoreGoogle<ResponseType extends GoogleResponse, Auth
|
|
|
38
38
|
abstract buildDeleteConnection(key: string): GoogleDownloadConnection<AsyncCallerCallOptions, GoogleResponse, AuthOptions>;
|
|
39
39
|
_del(key: string): Promise<void>;
|
|
40
40
|
mdelete(keys: string[]): Promise<void>;
|
|
41
|
+
// eslint-disable-next-line require-yield
|
|
41
42
|
yieldKeys(_prefix: string | undefined): AsyncGenerator<string>;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -108,7 +109,7 @@ declare abstract class BlobStoreGoogleCloudStorageBase<AuthOptions> extends Blob
|
|
|
108
109
|
type AIStudioFileState = "PROCESSING" | "ACTIVE" | "FAILED" | "STATE_UNSPECIFIED";
|
|
109
110
|
type AIStudioFileVideoMetadata = {
|
|
110
111
|
videoMetadata: {
|
|
111
|
-
videoDuration: string;
|
|
112
|
+
videoDuration: string; // Duration in seconds, possibly with fractional, ending in "s"
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
type AIStudioFileMetadata = AIStudioFileVideoMetadata;
|
|
@@ -116,11 +117,11 @@ interface AIStudioFileObject {
|
|
|
116
117
|
name?: string;
|
|
117
118
|
displayName?: string;
|
|
118
119
|
mimeType?: string;
|
|
119
|
-
sizeBytes?: string;
|
|
120
|
-
createTime?: string;
|
|
121
|
-
updateTime?: string;
|
|
122
|
-
expirationTime?: string;
|
|
123
|
-
sha256Hash?: string;
|
|
120
|
+
sizeBytes?: string; // int64 format
|
|
121
|
+
createTime?: string; // timestamp format
|
|
122
|
+
updateTime?: string; // timestamp format
|
|
123
|
+
expirationTime?: string; // timestamp format
|
|
124
|
+
sha256Hash?: string; // base64 encoded
|
|
124
125
|
uri?: string;
|
|
125
126
|
state?: AIStudioFileState;
|
|
126
127
|
error?: {
|
|
@@ -3,8 +3,8 @@ import { Serializable } from "@langchain/core/load/serializable";
|
|
|
3
3
|
|
|
4
4
|
//#region src/experimental/utils/media_core.d.ts
|
|
5
5
|
type MediaBlobData = {
|
|
6
|
-
value: string;
|
|
7
|
-
type: string;
|
|
6
|
+
value: string; // In Base64 encoding
|
|
7
|
+
type: string; // The mime type and possibly encoding
|
|
8
8
|
};
|
|
9
9
|
interface MediaBlobParameters {
|
|
10
10
|
data?: MediaBlobData;
|
|
@@ -19,6 +19,7 @@ declare class MediaBlob extends Serializable implements MediaBlobParameters {
|
|
|
19
19
|
lc_serializable: boolean;
|
|
20
20
|
lc_namespace: string[];
|
|
21
21
|
data: MediaBlobData;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
23
|
metadata?: Record<string, any>;
|
|
23
24
|
path?: string;
|
|
24
25
|
constructor(params: MediaBlobParameters);
|
|
@@ -89,7 +90,7 @@ interface BlobStoreOptions {
|
|
|
89
90
|
* implemented should be documented and throw an Error if called.
|
|
90
91
|
*/
|
|
91
92
|
declare abstract class BlobStore extends BaseStore<string, MediaBlob> {
|
|
92
|
-
lc_namespace: string[];
|
|
93
|
+
lc_namespace: string[]; // FIXME - What should this be? And why?
|
|
93
94
|
defaultStoreOptions: BlobStoreStoreOptions;
|
|
94
95
|
defaultFetchOptions: BlobStoreFetchOptions;
|
|
95
96
|
constructor(opts?: BlobStoreOptions);
|
|
@@ -3,8 +3,8 @@ import { Serializable } from "@langchain/core/load/serializable";
|
|
|
3
3
|
|
|
4
4
|
//#region src/experimental/utils/media_core.d.ts
|
|
5
5
|
type MediaBlobData = {
|
|
6
|
-
value: string;
|
|
7
|
-
type: string;
|
|
6
|
+
value: string; // In Base64 encoding
|
|
7
|
+
type: string; // The mime type and possibly encoding
|
|
8
8
|
};
|
|
9
9
|
interface MediaBlobParameters {
|
|
10
10
|
data?: MediaBlobData;
|
|
@@ -19,6 +19,7 @@ declare class MediaBlob extends Serializable implements MediaBlobParameters {
|
|
|
19
19
|
lc_serializable: boolean;
|
|
20
20
|
lc_namespace: string[];
|
|
21
21
|
data: MediaBlobData;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
23
|
metadata?: Record<string, any>;
|
|
23
24
|
path?: string;
|
|
24
25
|
constructor(params: MediaBlobParameters);
|
|
@@ -89,7 +90,7 @@ interface BlobStoreOptions {
|
|
|
89
90
|
* implemented should be documented and throw an Error if called.
|
|
90
91
|
*/
|
|
91
92
|
declare abstract class BlobStore extends BaseStore<string, MediaBlob> {
|
|
92
|
-
lc_namespace: string[];
|
|
93
|
+
lc_namespace: string[]; // FIXME - What should this be? And why?
|
|
93
94
|
defaultStoreOptions: BlobStoreStoreOptions;
|
|
94
95
|
defaultFetchOptions: BlobStoreFetchOptions;
|
|
95
96
|
constructor(opts?: BlobStoreOptions);
|
package/dist/llms.d.cts
CHANGED
|
@@ -15,6 +15,7 @@ declare class GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnecti
|
|
|
15
15
|
* Integration with an LLM.
|
|
16
16
|
*/
|
|
17
17
|
declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelCallOptions> implements GoogleBaseLLMInput<AuthOptions> {
|
|
18
|
+
// Used for tracing, replace with the same name as your class
|
|
18
19
|
static lc_name(): string;
|
|
19
20
|
get lc_secrets(): {
|
|
20
21
|
[key: string]: string;
|
|
@@ -40,6 +41,7 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
40
41
|
buildClient(fields?: GoogleAIBaseLLMInput<AuthOptions>): GoogleAbstractedClient;
|
|
41
42
|
buildConnection(fields: GoogleBaseLLMInput<AuthOptions>, client: GoogleAbstractedClient): void;
|
|
42
43
|
get platform(): GooglePlatformType;
|
|
44
|
+
// Replace
|
|
43
45
|
_llmType(): string;
|
|
44
46
|
formatPrompt(prompt: string): MessageContent;
|
|
45
47
|
/**
|
|
@@ -49,6 +51,9 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
49
51
|
* in order to handle public APi calls to `generate()`.
|
|
50
52
|
*/
|
|
51
53
|
_call(prompt: string, options: this["ParsedCallOptions"]): Promise<string>;
|
|
54
|
+
// Normally, you should not override this method and instead should override
|
|
55
|
+
// _streamResponseChunks. We are doing so here to allow for multimodal inputs into
|
|
56
|
+
// the LLM.
|
|
52
57
|
_streamIterator(input: BaseLanguageModelInput, options?: BaseLanguageModelCallOptions): AsyncGenerator<string>;
|
|
53
58
|
predictMessages(messages: BaseMessage[], options?: string[] | BaseLanguageModelCallOptions, _callbacks?: Callbacks): Promise<BaseMessage>;
|
|
54
59
|
/**
|
|
@@ -58,6 +63,8 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
58
63
|
* TODO: Replace with something less hacky.
|
|
59
64
|
*/
|
|
60
65
|
protected createProxyChat(): ChatGoogleBase<AuthOptions>;
|
|
66
|
+
// TODO: Remove the need to override this - we are doing it to
|
|
67
|
+
// allow the LLM to handle multimodal types of input.
|
|
61
68
|
invoke(input: BaseLanguageModelInput, options?: BaseLanguageModelCallOptions): Promise<string>;
|
|
62
69
|
}
|
|
63
70
|
//#endregion
|
package/dist/llms.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare class GoogleLLMConnection<AuthOptions> extends AbstractGoogleLLMConnecti
|
|
|
15
15
|
* Integration with an LLM.
|
|
16
16
|
*/
|
|
17
17
|
declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelCallOptions> implements GoogleBaseLLMInput<AuthOptions> {
|
|
18
|
+
// Used for tracing, replace with the same name as your class
|
|
18
19
|
static lc_name(): string;
|
|
19
20
|
get lc_secrets(): {
|
|
20
21
|
[key: string]: string;
|
|
@@ -40,6 +41,7 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
40
41
|
buildClient(fields?: GoogleAIBaseLLMInput<AuthOptions>): GoogleAbstractedClient;
|
|
41
42
|
buildConnection(fields: GoogleBaseLLMInput<AuthOptions>, client: GoogleAbstractedClient): void;
|
|
42
43
|
get platform(): GooglePlatformType;
|
|
44
|
+
// Replace
|
|
43
45
|
_llmType(): string;
|
|
44
46
|
formatPrompt(prompt: string): MessageContent;
|
|
45
47
|
/**
|
|
@@ -49,6 +51,9 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
49
51
|
* in order to handle public APi calls to `generate()`.
|
|
50
52
|
*/
|
|
51
53
|
_call(prompt: string, options: this["ParsedCallOptions"]): Promise<string>;
|
|
54
|
+
// Normally, you should not override this method and instead should override
|
|
55
|
+
// _streamResponseChunks. We are doing so here to allow for multimodal inputs into
|
|
56
|
+
// the LLM.
|
|
52
57
|
_streamIterator(input: BaseLanguageModelInput, options?: BaseLanguageModelCallOptions): AsyncGenerator<string>;
|
|
53
58
|
predictMessages(messages: BaseMessage[], options?: string[] | BaseLanguageModelCallOptions, _callbacks?: Callbacks): Promise<BaseMessage>;
|
|
54
59
|
/**
|
|
@@ -58,6 +63,8 @@ declare abstract class GoogleBaseLLM<AuthOptions> extends LLM<BaseLanguageModelC
|
|
|
58
63
|
* TODO: Replace with something less hacky.
|
|
59
64
|
*/
|
|
60
65
|
protected createProxyChat(): ChatGoogleBase<AuthOptions>;
|
|
66
|
+
// TODO: Remove the need to override this - we are doing it to
|
|
67
|
+
// allow the LLM to handle multimodal types of input.
|
|
61
68
|
invoke(input: BaseLanguageModelInput, options?: BaseLanguageModelCallOptions): Promise<string>;
|
|
62
69
|
}
|
|
63
70
|
//#endregion
|
|
@@ -62,6 +62,7 @@ interface AnthropicMessageContentRedactedThinking extends AnthropicMessageConten
|
|
|
62
62
|
type: "redacted_thinking";
|
|
63
63
|
data: string;
|
|
64
64
|
}
|
|
65
|
+
// TODO: Define this
|
|
65
66
|
type AnthropicMessageContentToolUseInput = object;
|
|
66
67
|
interface AnthropicMessageContentToolUse extends AnthropicMessageContentBase {
|
|
67
68
|
type: "tool_use";
|
|
@@ -98,9 +99,10 @@ interface AnthropicToolChoiceTool extends AnthropicToolChoiceBase {
|
|
|
98
99
|
name: string;
|
|
99
100
|
}
|
|
100
101
|
type AnthropicToolChoice = AnthropicToolChoiceAuto | AnthropicToolChoiceAny | AnthropicToolChoiceTool;
|
|
102
|
+
// TODO: Define this
|
|
101
103
|
type AnthropicToolInputSchema = object;
|
|
102
104
|
interface AnthropicTool {
|
|
103
|
-
type?: string;
|
|
105
|
+
type?: string; // Just available on tools 20241022 and later?
|
|
104
106
|
name: string;
|
|
105
107
|
description?: string;
|
|
106
108
|
cache_control?: AnthropicCacheControl;
|
|
@@ -219,6 +221,7 @@ interface AnthropicStreamPingEvent extends AnthropicStreamBaseEvent {
|
|
|
219
221
|
}
|
|
220
222
|
interface AnthropicStreamErrorEvent extends AnthropicStreamBaseEvent {
|
|
221
223
|
type: "error";
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
225
|
error: any;
|
|
223
226
|
}
|
|
224
227
|
//#endregion
|
|
@@ -62,6 +62,7 @@ interface AnthropicMessageContentRedactedThinking extends AnthropicMessageConten
|
|
|
62
62
|
type: "redacted_thinking";
|
|
63
63
|
data: string;
|
|
64
64
|
}
|
|
65
|
+
// TODO: Define this
|
|
65
66
|
type AnthropicMessageContentToolUseInput = object;
|
|
66
67
|
interface AnthropicMessageContentToolUse extends AnthropicMessageContentBase {
|
|
67
68
|
type: "tool_use";
|
|
@@ -98,9 +99,10 @@ interface AnthropicToolChoiceTool extends AnthropicToolChoiceBase {
|
|
|
98
99
|
name: string;
|
|
99
100
|
}
|
|
100
101
|
type AnthropicToolChoice = AnthropicToolChoiceAuto | AnthropicToolChoiceAny | AnthropicToolChoiceTool;
|
|
102
|
+
// TODO: Define this
|
|
101
103
|
type AnthropicToolInputSchema = object;
|
|
102
104
|
interface AnthropicTool {
|
|
103
|
-
type?: string;
|
|
105
|
+
type?: string; // Just available on tools 20241022 and later?
|
|
104
106
|
name: string;
|
|
105
107
|
description?: string;
|
|
106
108
|
cache_control?: AnthropicCacheControl;
|
|
@@ -219,6 +221,7 @@ interface AnthropicStreamPingEvent extends AnthropicStreamBaseEvent {
|
|
|
219
221
|
}
|
|
220
222
|
interface AnthropicStreamErrorEvent extends AnthropicStreamBaseEvent {
|
|
221
223
|
type: "error";
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
225
|
error: any;
|
|
223
226
|
}
|
|
224
227
|
//#endregion
|
package/dist/types.d.cts
CHANGED
|
@@ -90,7 +90,7 @@ type GoogleAISafetyMethod = (typeof GoogleAISafetyMethod)[keyof typeof GoogleAIS
|
|
|
90
90
|
interface GoogleAISafetySetting {
|
|
91
91
|
category: GoogleAISafetyCategory | string;
|
|
92
92
|
threshold: GoogleAISafetyThreshold | string;
|
|
93
|
-
method?: GoogleAISafetyMethod | string;
|
|
93
|
+
method?: GoogleAISafetyMethod | string; // Just for Vertex AI?
|
|
94
94
|
}
|
|
95
95
|
type GoogleAIResponseMimeType = "text/plain" | "application/json";
|
|
96
96
|
type GoogleAIModelModality = "TEXT" | "IMAGE" | "AUDIO" | string;
|
|
@@ -308,6 +308,7 @@ interface GoogleAIModelRequestParams extends GoogleAIModelParams {
|
|
|
308
308
|
*
|
|
309
309
|
* The tool configuration's "any" mode ("forced function calling") is supported for Gemini 1.5 Pro models only.
|
|
310
310
|
*/
|
|
311
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
311
312
|
tool_choice?: string | "auto" | "any" | "none" | Record<string, any>;
|
|
312
313
|
/**
|
|
313
314
|
* Allowed functions to call when the mode is "any".
|
|
@@ -339,17 +340,18 @@ interface GoogleAIBaseLanguageModelCallOptions extends BaseChatModelCallOptions,
|
|
|
339
340
|
*/
|
|
340
341
|
interface GoogleBaseLLMInput<AuthOptions> extends GoogleAIBaseLLMInput<AuthOptions> {}
|
|
341
342
|
interface GoogleResponse {
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
342
344
|
data: any;
|
|
343
345
|
}
|
|
344
346
|
interface GoogleRawResponse extends GoogleResponse {
|
|
345
347
|
data: Blob;
|
|
346
348
|
}
|
|
347
349
|
interface GeminiPartBase {
|
|
348
|
-
thought?: boolean;
|
|
350
|
+
thought?: boolean; // Output only
|
|
349
351
|
thoughtSignature?: string;
|
|
350
352
|
}
|
|
351
353
|
interface GeminiVideoMetadata {
|
|
352
|
-
fps?: number;
|
|
354
|
+
fps?: number; // Double in range (0.0, 24.0]
|
|
353
355
|
startOffset?: string;
|
|
354
356
|
endOffset?: string;
|
|
355
357
|
}
|
|
@@ -371,12 +373,14 @@ interface GeminiPartFileData extends GeminiPartBaseFile {
|
|
|
371
373
|
fileUri: string;
|
|
372
374
|
};
|
|
373
375
|
}
|
|
376
|
+
// AI Studio only?
|
|
374
377
|
interface GeminiPartFunctionCall extends GeminiPartBase {
|
|
375
378
|
functionCall: {
|
|
376
379
|
name: string;
|
|
377
380
|
args?: object;
|
|
378
381
|
};
|
|
379
382
|
}
|
|
383
|
+
// AI Studio Only?
|
|
380
384
|
interface GeminiPartFunctionResponse extends GeminiPartBase {
|
|
381
385
|
functionResponse: {
|
|
382
386
|
name: string;
|
|
@@ -404,9 +408,9 @@ interface GeminiCitation {
|
|
|
404
408
|
publicationDate: GoogleTypeDate;
|
|
405
409
|
}
|
|
406
410
|
interface GoogleTypeDate {
|
|
407
|
-
year: number;
|
|
408
|
-
month: number;
|
|
409
|
-
day: number;
|
|
411
|
+
year: number; // 1-9999 or 0 to specify a date without a year
|
|
412
|
+
month: number; // 1-12 or 0 to specify a year without a month and day
|
|
413
|
+
day: number; // Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant
|
|
410
414
|
}
|
|
411
415
|
interface GeminiGroundingMetadata {
|
|
412
416
|
webSearchQueries?: string[];
|
|
@@ -417,7 +421,7 @@ interface GeminiGroundingMetadata {
|
|
|
417
421
|
}
|
|
418
422
|
interface GeminiSearchEntryPoint {
|
|
419
423
|
renderedContent?: string;
|
|
420
|
-
sdkBlob?: string;
|
|
424
|
+
sdkBlob?: string; // Base64 encoded JSON representing array of tuple.
|
|
421
425
|
}
|
|
422
426
|
interface GeminiGroundingChunk {
|
|
423
427
|
web: GeminiGroundingChunkWeb;
|
|
@@ -470,18 +474,26 @@ interface GeminiLogprobsResultCandidate {
|
|
|
470
474
|
tokenId: number;
|
|
471
475
|
logProbability: number;
|
|
472
476
|
}
|
|
477
|
+
// The "system" content appears to only be valid in the systemInstruction
|
|
473
478
|
type GeminiRole = "system" | "user" | "model" | "function";
|
|
474
479
|
interface GeminiContent {
|
|
475
480
|
parts: GeminiPart[];
|
|
476
|
-
role: GeminiRole;
|
|
481
|
+
role: GeminiRole; // Vertex AI requires the role
|
|
477
482
|
}
|
|
483
|
+
/*
|
|
484
|
+
* If additional attributes are added here, they should also be
|
|
485
|
+
* added to the attributes below
|
|
486
|
+
*/
|
|
478
487
|
interface GeminiTool {
|
|
479
488
|
functionDeclarations?: GeminiFunctionDeclaration[];
|
|
480
|
-
googleSearchRetrieval?: GoogleSearchRetrieval;
|
|
481
|
-
googleSearch?: GoogleSearch;
|
|
489
|
+
googleSearchRetrieval?: GoogleSearchRetrieval; // Gemini-1.5
|
|
490
|
+
googleSearch?: GoogleSearch; // Gemini-2.0
|
|
482
491
|
urlContext?: UrlContext;
|
|
483
492
|
retrieval?: VertexAIRetrieval;
|
|
484
493
|
}
|
|
494
|
+
/*
|
|
495
|
+
* The known strings in this type should match those in GeminiSearchToolAttribuets
|
|
496
|
+
*/
|
|
485
497
|
type GoogleSearchToolSetting = boolean | "googleSearchRetrieval" | "googleSearch" | string;
|
|
486
498
|
declare const GeminiSearchToolAttributes: string[];
|
|
487
499
|
declare const GeminiToolAttributes: string[];
|
|
@@ -653,6 +665,7 @@ interface GoogleAIAPIParams {
|
|
|
653
665
|
apiName?: string;
|
|
654
666
|
apiConfig?: GoogleAIAPIConfig;
|
|
655
667
|
}
|
|
668
|
+
// Embeddings
|
|
656
669
|
/**
|
|
657
670
|
* Defines the parameters required to initialize a
|
|
658
671
|
* GoogleEmbeddings instance. It extends EmbeddingsParams and
|
|
@@ -697,7 +710,7 @@ interface AIStudioEmbeddingsRequest {
|
|
|
697
710
|
content: {
|
|
698
711
|
parts: GeminiPartText[];
|
|
699
712
|
};
|
|
700
|
-
model?: string;
|
|
713
|
+
model?: string; // Documentation says required, but tests say otherwise
|
|
701
714
|
taskType?: GoogleEmbeddingsTaskType;
|
|
702
715
|
title?: string;
|
|
703
716
|
outputDimensionality?: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ type GoogleAISafetyMethod = (typeof GoogleAISafetyMethod)[keyof typeof GoogleAIS
|
|
|
90
90
|
interface GoogleAISafetySetting {
|
|
91
91
|
category: GoogleAISafetyCategory | string;
|
|
92
92
|
threshold: GoogleAISafetyThreshold | string;
|
|
93
|
-
method?: GoogleAISafetyMethod | string;
|
|
93
|
+
method?: GoogleAISafetyMethod | string; // Just for Vertex AI?
|
|
94
94
|
}
|
|
95
95
|
type GoogleAIResponseMimeType = "text/plain" | "application/json";
|
|
96
96
|
type GoogleAIModelModality = "TEXT" | "IMAGE" | "AUDIO" | string;
|
|
@@ -308,6 +308,7 @@ interface GoogleAIModelRequestParams extends GoogleAIModelParams {
|
|
|
308
308
|
*
|
|
309
309
|
* The tool configuration's "any" mode ("forced function calling") is supported for Gemini 1.5 Pro models only.
|
|
310
310
|
*/
|
|
311
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
311
312
|
tool_choice?: string | "auto" | "any" | "none" | Record<string, any>;
|
|
312
313
|
/**
|
|
313
314
|
* Allowed functions to call when the mode is "any".
|
|
@@ -339,17 +340,18 @@ interface GoogleAIBaseLanguageModelCallOptions extends BaseChatModelCallOptions,
|
|
|
339
340
|
*/
|
|
340
341
|
interface GoogleBaseLLMInput<AuthOptions> extends GoogleAIBaseLLMInput<AuthOptions> {}
|
|
341
342
|
interface GoogleResponse {
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
342
344
|
data: any;
|
|
343
345
|
}
|
|
344
346
|
interface GoogleRawResponse extends GoogleResponse {
|
|
345
347
|
data: Blob;
|
|
346
348
|
}
|
|
347
349
|
interface GeminiPartBase {
|
|
348
|
-
thought?: boolean;
|
|
350
|
+
thought?: boolean; // Output only
|
|
349
351
|
thoughtSignature?: string;
|
|
350
352
|
}
|
|
351
353
|
interface GeminiVideoMetadata {
|
|
352
|
-
fps?: number;
|
|
354
|
+
fps?: number; // Double in range (0.0, 24.0]
|
|
353
355
|
startOffset?: string;
|
|
354
356
|
endOffset?: string;
|
|
355
357
|
}
|
|
@@ -371,12 +373,14 @@ interface GeminiPartFileData extends GeminiPartBaseFile {
|
|
|
371
373
|
fileUri: string;
|
|
372
374
|
};
|
|
373
375
|
}
|
|
376
|
+
// AI Studio only?
|
|
374
377
|
interface GeminiPartFunctionCall extends GeminiPartBase {
|
|
375
378
|
functionCall: {
|
|
376
379
|
name: string;
|
|
377
380
|
args?: object;
|
|
378
381
|
};
|
|
379
382
|
}
|
|
383
|
+
// AI Studio Only?
|
|
380
384
|
interface GeminiPartFunctionResponse extends GeminiPartBase {
|
|
381
385
|
functionResponse: {
|
|
382
386
|
name: string;
|
|
@@ -404,9 +408,9 @@ interface GeminiCitation {
|
|
|
404
408
|
publicationDate: GoogleTypeDate;
|
|
405
409
|
}
|
|
406
410
|
interface GoogleTypeDate {
|
|
407
|
-
year: number;
|
|
408
|
-
month: number;
|
|
409
|
-
day: number;
|
|
411
|
+
year: number; // 1-9999 or 0 to specify a date without a year
|
|
412
|
+
month: number; // 1-12 or 0 to specify a year without a month and day
|
|
413
|
+
day: number; // Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant
|
|
410
414
|
}
|
|
411
415
|
interface GeminiGroundingMetadata {
|
|
412
416
|
webSearchQueries?: string[];
|
|
@@ -417,7 +421,7 @@ interface GeminiGroundingMetadata {
|
|
|
417
421
|
}
|
|
418
422
|
interface GeminiSearchEntryPoint {
|
|
419
423
|
renderedContent?: string;
|
|
420
|
-
sdkBlob?: string;
|
|
424
|
+
sdkBlob?: string; // Base64 encoded JSON representing array of tuple.
|
|
421
425
|
}
|
|
422
426
|
interface GeminiGroundingChunk {
|
|
423
427
|
web: GeminiGroundingChunkWeb;
|
|
@@ -470,18 +474,26 @@ interface GeminiLogprobsResultCandidate {
|
|
|
470
474
|
tokenId: number;
|
|
471
475
|
logProbability: number;
|
|
472
476
|
}
|
|
477
|
+
// The "system" content appears to only be valid in the systemInstruction
|
|
473
478
|
type GeminiRole = "system" | "user" | "model" | "function";
|
|
474
479
|
interface GeminiContent {
|
|
475
480
|
parts: GeminiPart[];
|
|
476
|
-
role: GeminiRole;
|
|
481
|
+
role: GeminiRole; // Vertex AI requires the role
|
|
477
482
|
}
|
|
483
|
+
/*
|
|
484
|
+
* If additional attributes are added here, they should also be
|
|
485
|
+
* added to the attributes below
|
|
486
|
+
*/
|
|
478
487
|
interface GeminiTool {
|
|
479
488
|
functionDeclarations?: GeminiFunctionDeclaration[];
|
|
480
|
-
googleSearchRetrieval?: GoogleSearchRetrieval;
|
|
481
|
-
googleSearch?: GoogleSearch;
|
|
489
|
+
googleSearchRetrieval?: GoogleSearchRetrieval; // Gemini-1.5
|
|
490
|
+
googleSearch?: GoogleSearch; // Gemini-2.0
|
|
482
491
|
urlContext?: UrlContext;
|
|
483
492
|
retrieval?: VertexAIRetrieval;
|
|
484
493
|
}
|
|
494
|
+
/*
|
|
495
|
+
* The known strings in this type should match those in GeminiSearchToolAttribuets
|
|
496
|
+
*/
|
|
485
497
|
type GoogleSearchToolSetting = boolean | "googleSearchRetrieval" | "googleSearch" | string;
|
|
486
498
|
declare const GeminiSearchToolAttributes: string[];
|
|
487
499
|
declare const GeminiToolAttributes: string[];
|
|
@@ -653,6 +665,7 @@ interface GoogleAIAPIParams {
|
|
|
653
665
|
apiName?: string;
|
|
654
666
|
apiConfig?: GoogleAIAPIConfig;
|
|
655
667
|
}
|
|
668
|
+
// Embeddings
|
|
656
669
|
/**
|
|
657
670
|
* Defines the parameters required to initialize a
|
|
658
671
|
* GoogleEmbeddings instance. It extends EmbeddingsParams and
|
|
@@ -697,7 +710,7 @@ interface AIStudioEmbeddingsRequest {
|
|
|
697
710
|
content: {
|
|
698
711
|
parts: GeminiPartText[];
|
|
699
712
|
};
|
|
700
|
-
model?: string;
|
|
713
|
+
model?: string; // Documentation says required, but tests say otherwise
|
|
701
714
|
taskType?: GoogleEmbeddingsTaskType;
|
|
702
715
|
title?: string;
|
|
703
716
|
outputDimensionality?: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncCallerParams } from "@langchain/core/utils/async_caller";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/failed_handler.d.ts
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
declare function failedAttemptHandler(error: any): void;
|
|
5
6
|
declare function ensureParams(params?: AsyncCallerParams): AsyncCallerParams;
|
|
6
7
|
//#endregion
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncCallerParams } from "@langchain/core/utils/async_caller";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/failed_handler.d.ts
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
5
|
declare function failedAttemptHandler(error: any): void;
|
|
5
6
|
declare function ensureParams(params?: AsyncCallerParams): AsyncCallerParams;
|
|
6
7
|
//#endregion
|
package/dist/utils/palm.d.cts
CHANGED
package/dist/utils/palm.d.ts
CHANGED
package/dist/utils/safety.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { GoogleLLMResponse } from "../types.cjs";
|
|
|
3
3
|
//#region src/utils/safety.d.ts
|
|
4
4
|
declare class GoogleAISafetyError extends Error {
|
|
5
5
|
response: GoogleLLMResponse;
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
reply: any;
|
|
7
8
|
constructor(response: GoogleLLMResponse, message?: string);
|
|
8
9
|
}
|
package/dist/utils/safety.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { GoogleLLMResponse } from "../types.js";
|
|
|
3
3
|
//#region src/utils/safety.d.ts
|
|
4
4
|
declare class GoogleAISafetyError extends Error {
|
|
5
5
|
response: GoogleLLMResponse;
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
reply: any;
|
|
7
8
|
constructor(response: GoogleLLMResponse, message?: string);
|
|
8
9
|
}
|
package/dist/utils/stream.d.cts
CHANGED
|
@@ -14,6 +14,7 @@ interface AbstractStream {
|
|
|
14
14
|
* Get the next chunk that is coming from the stream.
|
|
15
15
|
* This chunk may be null, usually indicating the last chunk in the stream.
|
|
16
16
|
*/
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
18
|
nextChunk(): Promise<any>;
|
|
18
19
|
/**
|
|
19
20
|
* Is the stream done?
|
|
@@ -62,8 +63,14 @@ declare class JsonStream implements AbstractStream {
|
|
|
62
63
|
*/
|
|
63
64
|
_getFullObject(): object | null;
|
|
64
65
|
_simplifyObject(obj: unknown): object;
|
|
66
|
+
// Set up a potential Promise that the handler can resolve.
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
68
|
_chunkResolution: (chunk: any) => void;
|
|
69
|
+
// If there is no Promise (it is null), the handler must add it to the queue
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
71
|
_chunkPending: Promise<any> | null;
|
|
72
|
+
// A queue that will collect chunks while there is no Promise
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
74
|
_chunkQueue: any[];
|
|
68
75
|
/**
|
|
69
76
|
* Register that we have another chunk available for consumption.
|
|
@@ -71,11 +78,13 @@ declare class JsonStream implements AbstractStream {
|
|
|
71
78
|
* If not, then add it to the queue.
|
|
72
79
|
* @param chunk
|
|
73
80
|
*/
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
82
|
_handleChunk(chunk: any): void;
|
|
75
83
|
/**
|
|
76
84
|
* Get the next chunk that is coming from the stream.
|
|
77
85
|
* This chunk may be null, usually indicating the last chunk in the stream.
|
|
78
86
|
*/
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
88
|
nextChunk(): Promise<any>;
|
|
80
89
|
/**
|
|
81
90
|
* Is the stream done?
|
|
@@ -95,8 +104,12 @@ declare class ReadableAbstractStream implements AbstractStream {
|
|
|
95
104
|
constructor(baseStream: AbstractStream, body: ReadableStream | null);
|
|
96
105
|
appendBuffer(data: string): void;
|
|
97
106
|
closeBuffer(): void;
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
108
|
nextChunk(): Promise<any>;
|
|
99
109
|
get streamDone(): boolean;
|
|
110
|
+
// Should be a ReadableStream, but the Gaxios Readable stream isn't.
|
|
111
|
+
// But both should support async iterators, so make sure of that.
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
113
|
run(body: any): Promise<void>;
|
|
101
114
|
}
|
|
102
115
|
declare class ReadableJsonStream extends ReadableAbstractStream {
|
|
@@ -121,10 +134,17 @@ declare class SseStream implements AbstractStream {
|
|
|
121
134
|
* @param event
|
|
122
135
|
*/
|
|
123
136
|
_parseEvent(event: string | null): Record<string, string> | null;
|
|
137
|
+
// Set up a potential Promise that the handler can resolve.
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
139
|
_chunkResolution: (chunk: any) => void;
|
|
140
|
+
// If there is no Promise (it is null), the handler must add it to the queue
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
142
|
_chunkPending: Promise<any> | null;
|
|
143
|
+
// A queue that will collect chunks while there is no Promise
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
145
|
_chunkQueue: any[];
|
|
127
146
|
_handleEvent(event: string | null): void;
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
148
|
nextChunk(): Promise<any>;
|
|
129
149
|
get streamDone(): boolean;
|
|
130
150
|
}
|
|
@@ -134,6 +154,7 @@ declare class ReadableSseStream extends ReadableAbstractStream {
|
|
|
134
154
|
declare class SseJsonStream extends SseStream {
|
|
135
155
|
_jsonAttribute: string;
|
|
136
156
|
constructor(jsonAttribute?: string);
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
137
158
|
nextChunk(): Promise<any>;
|
|
138
159
|
}
|
|
139
160
|
declare class ReadableSseJsonStream extends ReadableAbstractStream {
|
package/dist/utils/stream.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface AbstractStream {
|
|
|
14
14
|
* Get the next chunk that is coming from the stream.
|
|
15
15
|
* This chunk may be null, usually indicating the last chunk in the stream.
|
|
16
16
|
*/
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
18
|
nextChunk(): Promise<any>;
|
|
18
19
|
/**
|
|
19
20
|
* Is the stream done?
|
|
@@ -62,8 +63,14 @@ declare class JsonStream implements AbstractStream {
|
|
|
62
63
|
*/
|
|
63
64
|
_getFullObject(): object | null;
|
|
64
65
|
_simplifyObject(obj: unknown): object;
|
|
66
|
+
// Set up a potential Promise that the handler can resolve.
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
68
|
_chunkResolution: (chunk: any) => void;
|
|
69
|
+
// If there is no Promise (it is null), the handler must add it to the queue
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
71
|
_chunkPending: Promise<any> | null;
|
|
72
|
+
// A queue that will collect chunks while there is no Promise
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
74
|
_chunkQueue: any[];
|
|
68
75
|
/**
|
|
69
76
|
* Register that we have another chunk available for consumption.
|
|
@@ -71,11 +78,13 @@ declare class JsonStream implements AbstractStream {
|
|
|
71
78
|
* If not, then add it to the queue.
|
|
72
79
|
* @param chunk
|
|
73
80
|
*/
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
82
|
_handleChunk(chunk: any): void;
|
|
75
83
|
/**
|
|
76
84
|
* Get the next chunk that is coming from the stream.
|
|
77
85
|
* This chunk may be null, usually indicating the last chunk in the stream.
|
|
78
86
|
*/
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
88
|
nextChunk(): Promise<any>;
|
|
80
89
|
/**
|
|
81
90
|
* Is the stream done?
|
|
@@ -95,8 +104,12 @@ declare class ReadableAbstractStream implements AbstractStream {
|
|
|
95
104
|
constructor(baseStream: AbstractStream, body: ReadableStream | null);
|
|
96
105
|
appendBuffer(data: string): void;
|
|
97
106
|
closeBuffer(): void;
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
108
|
nextChunk(): Promise<any>;
|
|
99
109
|
get streamDone(): boolean;
|
|
110
|
+
// Should be a ReadableStream, but the Gaxios Readable stream isn't.
|
|
111
|
+
// But both should support async iterators, so make sure of that.
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
113
|
run(body: any): Promise<void>;
|
|
101
114
|
}
|
|
102
115
|
declare class ReadableJsonStream extends ReadableAbstractStream {
|
|
@@ -121,10 +134,17 @@ declare class SseStream implements AbstractStream {
|
|
|
121
134
|
* @param event
|
|
122
135
|
*/
|
|
123
136
|
_parseEvent(event: string | null): Record<string, string> | null;
|
|
137
|
+
// Set up a potential Promise that the handler can resolve.
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
139
|
_chunkResolution: (chunk: any) => void;
|
|
140
|
+
// If there is no Promise (it is null), the handler must add it to the queue
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
142
|
_chunkPending: Promise<any> | null;
|
|
143
|
+
// A queue that will collect chunks while there is no Promise
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
145
|
_chunkQueue: any[];
|
|
127
146
|
_handleEvent(event: string | null): void;
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
148
|
nextChunk(): Promise<any>;
|
|
129
149
|
get streamDone(): boolean;
|
|
130
150
|
}
|
|
@@ -134,6 +154,7 @@ declare class ReadableSseStream extends ReadableAbstractStream {
|
|
|
134
154
|
declare class SseJsonStream extends SseStream {
|
|
135
155
|
_jsonAttribute: string;
|
|
136
156
|
constructor(jsonAttribute?: string);
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
137
158
|
nextChunk(): Promise<any>;
|
|
138
159
|
}
|
|
139
160
|
declare class ReadableSseJsonStream extends ReadableAbstractStream {
|
|
@@ -3,10 +3,20 @@ import { InteropZodType } from "@langchain/core/utils/types";
|
|
|
3
3
|
import { JsonSchema7Type } from "@langchain/core/utils/json_schema";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/zod_to_gemini_parameters.d.ts
|
|
6
|
-
declare function adjustObjectType(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
declare function adjustObjectType(
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
obj: Record<string, any>
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
): Record<string, any>;
|
|
11
|
+
declare function removeAdditionalProperties(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
obj: Record<string, any>): GeminiJsonSchema;
|
|
14
|
+
declare function schemaToGeminiParameters<
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | JsonSchema7Type): GeminiFunctionSchema;
|
|
17
|
+
declare function jsonSchemaToGeminiParameters(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
schema: Record<string, any>): GeminiFunctionSchema;
|
|
10
20
|
//#endregion
|
|
11
21
|
export { adjustObjectType, jsonSchemaToGeminiParameters, removeAdditionalProperties, schemaToGeminiParameters };
|
|
12
22
|
//# sourceMappingURL=zod_to_gemini_parameters.d.cts.map
|
|
@@ -3,10 +3,20 @@ import { InteropZodType } from "@langchain/core/utils/types";
|
|
|
3
3
|
import { JsonSchema7Type } from "@langchain/core/utils/json_schema";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/zod_to_gemini_parameters.d.ts
|
|
6
|
-
declare function adjustObjectType(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
declare function adjustObjectType(
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
obj: Record<string, any>
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
): Record<string, any>;
|
|
11
|
+
declare function removeAdditionalProperties(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
obj: Record<string, any>): GeminiJsonSchema;
|
|
14
|
+
declare function schemaToGeminiParameters<
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | JsonSchema7Type): GeminiFunctionSchema;
|
|
17
|
+
declare function jsonSchemaToGeminiParameters(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
schema: Record<string, any>): GeminiFunctionSchema;
|
|
10
20
|
//#endregion
|
|
11
21
|
export { adjustObjectType, jsonSchemaToGeminiParameters, removeAdditionalProperties, schemaToGeminiParameters };
|
|
12
22
|
//# sourceMappingURL=zod_to_gemini_parameters.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/google-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Core types and classes for Google services.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"uuid": "^10.0.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@langchain/core": "1.1.
|
|
20
|
+
"@langchain/core": "1.1.4"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@jest/globals": "^29.5.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"ts-jest": "^29.1.0",
|
|
36
36
|
"typescript": "~5.8.3",
|
|
37
37
|
"zod": "^3.25.76",
|
|
38
|
-
"@langchain/core": "1.1.
|
|
38
|
+
"@langchain/core": "1.1.4",
|
|
39
39
|
"@langchain/eslint": "0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|