@firebase/ai 2.11.0 → 2.11.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/src/api.d.ts CHANGED
@@ -23,10 +23,10 @@ import { AIError } from './errors';
23
23
  import { AIModel, GenerativeModel, LiveGenerativeModel, ImagenModel } from './models';
24
24
  import { TemplateGenerativeModel } from './models/template-generative-model';
25
25
  import { TemplateImagenModel } from './models/template-imagen-model';
26
+ export { TemplateChatSession } from './public-types';
26
27
  export { ChatSession } from './methods/chat-session';
27
28
  export { ChatSessionBase } from './methods/chat-session-base';
28
29
  export { LiveSession } from './methods/live-session';
29
- export { TemplateChatSession } from './methods/template-chat-session';
30
30
  export * from './requests/schema-builder';
31
31
  export { ImagenImageFormat } from './requests/imagen-image-format';
32
32
  export { AIModel, GenerativeModel, LiveGenerativeModel, ImagenModel, TemplateGenerativeModel, TemplateImagenModel, AIError };
@@ -17,6 +17,7 @@
17
17
  import { Content, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartTemplateChatParams, TemplateFunctionDeclarationsTool, TemplateRequestInternal } from '../types';
18
18
  import { ApiSettings } from '../types/internal';
19
19
  import { ChatSessionBase } from './chat-session-base';
20
+ import { TemplateChatSession } from '../public-types';
20
21
  /**
21
22
  * `ChatSession` class for use with server prompt templates that
22
23
  * enables sending chat messages and stores history of sent and
@@ -24,7 +25,7 @@ import { ChatSessionBase } from './chat-session-base';
24
25
  *
25
26
  * @beta
26
27
  */
27
- export declare class TemplateChatSession extends ChatSessionBase<StartTemplateChatParams, TemplateRequestInternal, TemplateFunctionDeclarationsTool> {
28
+ export declare class TemplateChatSessionImpl extends ChatSessionBase<StartTemplateChatParams, TemplateRequestInternal, TemplateFunctionDeclarationsTool> implements TemplateChatSession {
28
29
  params: StartTemplateChatParams;
29
30
  requestOptions?: RequestOptions | undefined;
30
31
  constructor(apiSettings: ApiSettings, params: StartTemplateChatParams, requestOptions?: RequestOptions | undefined);
@@ -15,9 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { GenerateContentResult, RequestOptions } from '../types';
18
- import { AI, GenerateContentStreamResult, SingleRequestOptions, StartTemplateChatParams } from '../public-types';
18
+ import { AI, GenerateContentStreamResult, SingleRequestOptions, StartTemplateChatParams, TemplateChatSession } from '../public-types';
19
19
  import { ApiSettings } from '../types/internal';
20
- import { TemplateChatSession } from '../methods/template-chat-session';
21
20
  /**
22
21
  * {@link GenerativeModel} APIs that execute on a server-side template.
23
22
  *
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { FirebaseApp } from '@firebase/app';
18
18
  import { Backend } from './backend';
19
+ import { Content, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartTemplateChatParams } from './types';
19
20
  export * from './types';
20
21
  /**
21
22
  * An instance of the Firebase AI SDK.
@@ -95,3 +96,31 @@ export interface AIOptions {
95
96
  */
96
97
  useLimitedUseAppCheckTokens?: boolean;
97
98
  }
99
+ /**
100
+ * Interface representing a `ChatSession` class for use with server
101
+ * prompt templates that enables sending chat messages and stores
102
+ * history of sent and received messages so far.
103
+ *
104
+ * @beta
105
+ */
106
+ export interface TemplateChatSession {
107
+ params: StartTemplateChatParams;
108
+ requestOptions?: RequestOptions;
109
+ /**
110
+ * Sends a chat message and receives a non-streaming
111
+ * {@link GenerateContentResult}
112
+ */
113
+ sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
114
+ /**
115
+ * Sends a chat message and receives the response as a
116
+ * {@link GenerateContentStreamResult} containing an iterable stream
117
+ * and a response promise.
118
+ */
119
+ sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
120
+ /**
121
+ * Gets the chat history so far. Blocked prompts are not added to history.
122
+ * Neither blocked candidates nor the prompts that generated them are added
123
+ * to history.
124
+ */
125
+ getHistory(): Promise<Content[]>;
126
+ }
@@ -60,7 +60,7 @@ export interface GenerateContentRequest extends BaseParams {
60
60
  }
61
61
  /**
62
62
  * Request sent through {@link TemplateGenerativeModel.generateContent}
63
- * @beta
63
+ * @internal
64
64
  */
65
65
  export interface TemplateGenerateContentRequest {
66
66
  inputs?: Record<string, unknown>;
@@ -388,11 +388,10 @@ export interface GoogleSearchTool {
388
388
  /**
389
389
  * A tool that enables the model to use code execution.
390
390
  *
391
- * @beta
391
+ * @public
392
392
  */
393
393
  export interface CodeExecutionTool {
394
394
  /**
395
- * Specifies the Google Search configuration.
396
395
  * Currently, this is an empty object, but it's reserved for future configuration options.
397
396
  */
398
397
  codeExecution: {};
@@ -411,7 +410,7 @@ export interface GoogleSearch {
411
410
  * URLs. By including URLs in your request, the Gemini model will access the content from those
412
411
  * pages to inform and enhance its response.
413
412
  *
414
- * @beta
413
+ * @public
415
414
  */
416
415
  export interface URLContextTool {
417
416
  /**
@@ -422,7 +421,7 @@ export interface URLContextTool {
422
421
  /**
423
422
  * Specifies the URL Context configuration.
424
423
  *
425
- * @beta
424
+ * @public
426
425
  */
427
426
  export interface URLContext {
428
427
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/ai",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "The Firebase AI SDK",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "engines": {