googleapis / nodejs-vertexai

Apache License 2.0
113 stars 42 forks source link

how can i train gemini to generate structured data like json? #446

Open qingfengmy opened 5 days ago

qingfengmy commented 5 days ago

I want Gemini to generate structured data, such as [{name:'allen',year:2020,month:12,day:11},{name:'tracy',year:2024,month:2,day:23}], instead of generating descriptive text like ‘Allen was born on December 1, 2020, and Tracy was born on February 23, 2024.’ How can I achieve this?

This way, I won’t need to concatenate data from the string anymore.

SinanGabel commented 5 days ago

You can simply prompt Gemini itself with the question you have just posed, it will then tell you how-to. Remember to tell Gemini that you want use the nodejs-vertexai library and that you use javascript and nodejs. Use the Chat function so you can ask follow up questions.

On Tue, 22 Oct 2024 at 13:01, qingfengmy @.***> wrote:

I want Gemini to generate structured data, such as [{name:'allen',year:2020,month:12,day:11},{name:'tracy',year:2024,month:2,day:23}], instead of generating descriptive text like ‘Allen was born on December 1, 2020, and Tracy was born on February 23, 2024.’ How can I achieve this?

This way, I won’t need to concatenate data from the string anymore.

— Reply to this email directly, view it on GitHub https://github.com/googleapis/nodejs-vertexai/issues/446, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKTZUQWRF4W2VOQ3LCDL5LZ4YWB3AVCNFSM6AAAAABQMG3CI6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYDKMJQGQZDKMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>