We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EmbedContentRequest
When serializing EmbedContentRequest object, the JSON will be:
{ "model": "models/embedding-001", "content": { "parts": [ { "text": "Hello" } ], "text": "Hello" } }
Here is my sample code:
var request = new EmbedContentRequest("Hello"); var json = JsonSerializer.Serialize(request, new JsonSerializerOptions(JsonSerializerDefaults.Web) { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, PropertyNamingPolicy = JsonNamingPolicy.CamelCase, DictionaryKeyPolicy = JsonNamingPolicy.CamelCase, NumberHandling = JsonNumberHandling.AllowReadingFromString, PropertyNameCaseInsensitive = true, ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, Converters = { (JsonConverter)new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseUpper) } }).Dump();
See screenshot:
There are two issues:
model
content.text
{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \"text\" at 'content': Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "field": "content", "description": "Invalid JSON payload received. Unknown name \"text\" at 'content': Cannot find field." } ] } ] } }
The ContentResponse class is not obey the API doc Content definition. Only parts and role are defined.
ContentResponse
parts
role
The text was updated successfully, but these errors were encountered:
models/embedding-001
fixes mscraftsman#14
0008b0f
Thanks @doggy8088
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
When serializing
EmbedContentRequest
object, the JSON will be:Here is my sample code:
See screenshot:
There are two issues:
model
property is not necessary, but no error will be thrown.content.text
property will produce error.The
ContentResponse
class is not obey the API doc Content definition. Onlyparts
androle
are defined.The text was updated successfully, but these errors were encountered: