Skip to content

Commit

Permalink
Update GenerativeModel.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
a-maurice committed Feb 14, 2025
1 parent 8228574 commit 06f3991
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vertexai/src/GenerativeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* limitations under the License.
*/

// For now, using this to hide some functions causing problems with the build.
#define HIDE_IASYNCENUMERABLE

using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -100,8 +103,7 @@ public Task<GenerateContentResponse> GenerateContentAsync(
return GenerateContentAsyncInternal(content);
}

#define HIDE_IASYNCENUMERABLE
#if !defined(HIDE_IASYNCENUMERABLE)
#if !HIDE_IASYNCENUMERABLE
public IAsyncEnumerable<GenerateContentResponse> GenerateContentStreamAsync(
params ModelContent[] content) {
return GenerateContentStreamAsync((IEnumerable<ModelContent>)content);
Expand Down Expand Up @@ -163,7 +165,7 @@ private async Task<GenerateContentResponse> GenerateContentAsyncInternal(
return GenerateContentResponse.FromJson(result);
}

#if !defined(HIDE_IASYNCENUMERABLE)
#if !HIDE_IASYNCENUMERABLE
private async IAsyncEnumerable<GenerateContentResponse> GenerateContentStreamAsyncInternal(
IEnumerable<ModelContent> content) {
// TODO: Implementation
Expand All @@ -188,12 +190,11 @@ private string GetURL() {
}

private string ModelContentsToJson(IEnumerable<ModelContent> contents) {
Dictionary<string, object> jsonDict = new()
{
Dictionary<string, object> jsonDict = new() {
// Convert the Contents into a list of Json dictionaries
["contents"] = contents.Select(c => c.ToJson()).ToList()
// TODO: All the other settings
};
// TODO: All the other settings

return Json.Serialize(jsonDict);
}
Expand Down

0 comments on commit 06f3991

Please sign in to comment.