@ai-sdk/google-vertex 1.0.4 → 2.0.1

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,30 +1,10 @@
1
1
  import { ProviderV1, LanguageModelV1 } from '@ai-sdk/provider';
2
- import { VertexInit, VertexAI } from '@google-cloud/vertexai';
2
+ import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { InternalGoogleGenerativeAISettings } from '@ai-sdk/google/internal';
4
+ import { GoogleAuthOptions } from 'google-auth-library';
3
5
 
4
- type GoogleVertexModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision' | 'gemini-1.0-pro-vision-001' | (string & {});
5
- interface GoogleVertexSettings {
6
- /**
7
- * Optional. Enable structured output. Default is true.
8
- *
9
- * This is useful when the JSON Schema contains elements that are
10
- * not supported by the OpenAPI schema version that
11
- * Google Generative AI uses. You can use this to disable
12
- * structured outputs if you need to.
13
- */
14
- structuredOutputs?: boolean;
15
- /**
16
- Optional. A list of unique safety settings for blocking unsafe content.
17
- */
18
- safetySettings?: Array<{
19
- category: 'HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT';
20
- threshold: 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE';
21
- }>;
22
- /**
23
- Optional. When enabled, the model will use Google search to ground the response.
24
-
25
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
26
- */
27
- useSearchGrounding?: boolean;
6
+ type GoogleVertexModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-002' | (string & {});
7
+ interface GoogleVertexSettings extends InternalGoogleGenerativeAISettings {
28
8
  }
29
9
 
30
10
  interface GoogleVertexProvider extends ProviderV1 {
@@ -34,7 +14,7 @@ interface GoogleVertexProvider extends ProviderV1 {
34
14
  (modelId: GoogleVertexModelId, settings?: GoogleVertexSettings): LanguageModelV1;
35
15
  languageModel: (modelId: GoogleVertexModelId, settings?: GoogleVertexSettings) => LanguageModelV1;
36
16
  }
37
- interface GoogleVertexProviderSettings {
17
+ interface GoogleVertexProviderSettings$1 {
38
18
  /**
39
19
  Your Google Vertex location. Defaults to the environment variable `GOOGLE_VERTEX_LOCATION`.
40
20
  */
@@ -43,22 +23,32 @@ interface GoogleVertexProviderSettings {
43
23
  Your Google Vertex project. Defaults to the environment variable `GOOGLE_VERTEX_PROJECT`.
44
24
  */
45
25
  project?: string;
26
+ /**
27
+ * Headers to use for requests. Can be:
28
+ * - A headers object
29
+ * - A Promise that resolves to a headers object
30
+ * - A function that returns a headers object
31
+ * - A function that returns a Promise of a headers object
32
+ */
33
+ headers?: Resolvable<Record<string, string | undefined>>;
34
+ /**
35
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
36
+ or to provide a custom fetch implementation for e.g. testing.
37
+ */
38
+ fetch?: FetchFunction;
39
+ generateId?: () => string;
40
+ }
41
+
42
+ interface GoogleVertexProviderSettings extends GoogleVertexProviderSettings$1 {
46
43
  /**
47
44
  Optional. The Authentication options provided by google-auth-library.
48
45
  Complete list of authentication options is documented in the
49
46
  GoogleAuthOptions interface:
50
47
  https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.
51
48
  */
52
- googleAuthOptions?: VertexInit['googleAuthOptions'];
53
- generateId?: () => string;
54
- createVertexAI?: ({ project, location, }: {
55
- project: string;
56
- location: string;
57
- }) => VertexAI;
49
+ googleAuthOptions?: GoogleAuthOptions;
58
50
  }
59
- /**
60
- Create a Google Vertex AI provider instance.
61
- */
51
+
62
52
  declare function createVertex(options?: GoogleVertexProviderSettings): GoogleVertexProvider;
63
53
  /**
64
54
  Default Google Vertex AI provider instance.