nodejs-docs-samples icon indicating copy to clipboard operation
nodejs-docs-samples copied to clipboard

bug: multiparts doesn't match to defined types (Part)

Open 5war00p opened this issue 1 year ago • 2 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

The issue you're having must be related to a file in this repository. We are unable to provide assistance for issues unrelated to samples in this repository.

Please include as much information as possible:

In which file did you encounter the issue?

I was using generative snippets so I see this issue in generative/snippets in a few files which uses the multipart.

  • generative/snippets/nonStreamingMultipartContent.js
  • generative/snippets/sendMultiModalPromptWithImage.js
  • generative/snippets/sendMultiModalPromptWithVideo.js
  • generative/snippets/streamMultipartContent.js

Did you change the file? If so, how?

No

Describe the issue

The issue is in using Parts inside generative/snippets apart from text other Parts like file, inline needs to be updated to snake_case instead of pascalCase because the types were defined in snake_case. This will be problem helpful for users who are trying with TS.

Thanks!

5war00p avatar Jan 18 '24 06:01 5war00p

Hi @5war00p - thanks so much for adding the issue! Is this specifically for typescript users that you are adding this issue for? As it stands, these samples target vanilla JS and follows the request body structure stipulated in https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/gemini#request_body.

pattishin avatar Feb 07 '24 19:02 pattishin

Yes, I couldn't find Typescript samples and the npm package is not running these examples properly, so I went through protos and created this PR.

But I didn't try the js mode of this npm package.

5war00p avatar Feb 07 '24 19:02 5war00p

@5war00p As there aren't any ts gen ai samples at this time, we will make a note of the need to update the types when we do create ts sample equivalents. Appreciate it, thank you!

pattishin avatar Feb 21 '24 17:02 pattishin