20
20
using System . Runtime . CompilerServices ;
21
21
using System . Threading ;
22
22
using System . Threading . Tasks ;
23
- using Firebase . VertexAI . Internal ;
23
+ using Firebase . FirebaseAI . Internal ;
24
24
25
- namespace Firebase . VertexAI {
25
+ namespace Firebase . FirebaseAI {
26
26
27
27
/// <summary>
28
28
/// An object that represents a back-and-forth chat with a model, capturing the history and saving
@@ -64,7 +64,7 @@ internal static Chat InternalCreateChat(GenerativeModel model, IEnumerable<Model
64
64
/// <param name="content">The input given to the model as a prompt.</param>
65
65
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
66
66
/// <returns>The model's response if no error occurred.</returns>
67
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
67
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
68
68
public Task < GenerateContentResponse > SendMessageAsync (
69
69
ModelContent content , CancellationToken cancellationToken = default ) {
70
70
return SendMessageAsync ( new [ ] { content } , cancellationToken ) ;
@@ -76,7 +76,7 @@ public Task<GenerateContentResponse> SendMessageAsync(
76
76
/// <param name="text">The text given to the model as a prompt.</param>
77
77
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
78
78
/// <returns>The model's response if no error occurred.</returns>
79
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
79
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
80
80
public Task < GenerateContentResponse > SendMessageAsync (
81
81
string text , CancellationToken cancellationToken = default ) {
82
82
return SendMessageAsync ( new ModelContent [ ] { ModelContent . Text ( text ) } , cancellationToken ) ;
@@ -88,7 +88,7 @@ public Task<GenerateContentResponse> SendMessageAsync(
88
88
/// <param name="content">The input given to the model as a prompt.</param>
89
89
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
90
90
/// <returns>The model's response if no error occurred.</returns>
91
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
91
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
92
92
public Task < GenerateContentResponse > SendMessageAsync (
93
93
IEnumerable < ModelContent > content , CancellationToken cancellationToken = default ) {
94
94
return SendMessageAsyncInternal ( content , cancellationToken ) ;
@@ -101,7 +101,7 @@ public Task<GenerateContentResponse> SendMessageAsync(
101
101
/// <param name="content">The input given to the model as a prompt.</param>
102
102
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
103
103
/// <returns>A stream of generated content responses from the model.</returns>
104
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
104
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
105
105
public IAsyncEnumerable < GenerateContentResponse > SendMessageStreamAsync (
106
106
ModelContent content , CancellationToken cancellationToken = default ) {
107
107
return SendMessageStreamAsync ( new [ ] { content } , cancellationToken ) ;
@@ -113,7 +113,7 @@ public IAsyncEnumerable<GenerateContentResponse> SendMessageStreamAsync(
113
113
/// <param name="text">The text given to the model as a prompt.</param>
114
114
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
115
115
/// <returns>A stream of generated content responses from the model.</returns>
116
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
116
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
117
117
public IAsyncEnumerable < GenerateContentResponse > SendMessageStreamAsync (
118
118
string text , CancellationToken cancellationToken = default ) {
119
119
return SendMessageStreamAsync ( new ModelContent [ ] { ModelContent . Text ( text ) } , cancellationToken ) ;
@@ -125,7 +125,7 @@ public IAsyncEnumerable<GenerateContentResponse> SendMessageStreamAsync(
125
125
/// <param name="content">The input given to the model as a prompt.</param>
126
126
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
127
127
/// <returns>A stream of generated content responses from the model.</returns>
128
- /// <exception cref="VertexAIException ">Thrown when an error occurs during content generation.</exception>
128
+ /// <exception cref="FirebaseAIException ">Thrown when an error occurs during content generation.</exception>
129
129
public IAsyncEnumerable < GenerateContentResponse > SendMessageStreamAsync (
130
130
IEnumerable < ModelContent > content , CancellationToken cancellationToken = default ) {
131
131
return SendMessageStreamAsyncInternal ( content , cancellationToken ) ;
@@ -134,7 +134,7 @@ public IAsyncEnumerable<GenerateContentResponse> SendMessageStreamAsync(
134
134
private async Task < GenerateContentResponse > SendMessageAsyncInternal (
135
135
IEnumerable < ModelContent > requestContent , CancellationToken cancellationToken = default ) {
136
136
// Make sure that the requests are set to to role "user".
137
- List < ModelContent > fixedRequests = requestContent . Select ( VertexAIExtensions . ConvertToUser ) . ToList ( ) ;
137
+ List < ModelContent > fixedRequests = requestContent . Select ( FirebaseAIExtensions . ConvertToUser ) . ToList ( ) ;
138
138
// Set up the context to send in the request
139
139
List < ModelContent > fullRequest = new ( chatHistory ) ;
140
140
fullRequest . AddRange ( fixedRequests ) ;
@@ -159,7 +159,7 @@ private async IAsyncEnumerable<GenerateContentResponse> SendMessageStreamAsyncIn
159
159
IEnumerable < ModelContent > requestContent ,
160
160
[ EnumeratorCancellation ] CancellationToken cancellationToken = default ) {
161
161
// Make sure that the requests are set to to role "user".
162
- List < ModelContent > fixedRequests = requestContent . Select ( VertexAIExtensions . ConvertToUser ) . ToList ( ) ;
162
+ List < ModelContent > fixedRequests = requestContent . Select ( FirebaseAIExtensions . ConvertToUser ) . ToList ( ) ;
163
163
// Set up the context to send in the request
164
164
List < ModelContent > fullRequest = new ( chatHistory ) ;
165
165
fullRequest . AddRange ( fixedRequests ) ;
0 commit comments