Linkta-org / sandbox

Sandbox sprint repo for core functionality prototype
MIT License
3 stars 1 forks source link

Backend Send User Prompt to GEMINI, Return in JSON, Store in Database #7

Closed ChTiSh closed 4 months ago

ChTiSh commented 4 months ago

Objective: Figure out the workflow and potential limits/road blocks for the functionality: <Send User Prompt to GEMINI, return the React Flow tree data in JSON, store in Database>

PreReq: Initial Study for prompting, see Gemini cookbook:https://github.com/google-gemini/cookbook - 4 hours Gemini API Key + Project Setup for Testing - 1 hour

Please refer to Darren's gemini PR: https://github.com/Linkta-org/core/pull/64

Ticket Scope:

  1. Backend send user prompts to GEMINI API [hardcode user input/prompt - text only] - 4 hours
  2. Receive and store the returned JSON under the same user + input to Mongo Database, [Please refer to Schemas] - Please contact @ChTiSh for testing database credentials - 2 hours

Acceptance Criteria: AC1: API Response Handling

Given the GEMINI API receives the user input, When GEMINI processes the input and generates tree data, Then the API should send this data back to the frontend in JSON format.

AC2: Data Storage

Given the frontend receives JSON tree data, When the data is received, Then it should be stored in MongoDB according to the specified schema.

AC3: Explore in Sizes and Time (Gemini 1.0 and Gemini 1.0 Pro) - 1.5 has too litttle limit

Explore 3 different user input size (30 characters, 3000 characters, 30000 characters) Record Time and Token Used for each type

Stretch Goal: Can gemini generate react-flow code instead of just JSON for nodes and edges?

Reference: For gemini-1.0-pro, only the text field is valid. The token limit is 32,760. For gemini-1.0-pro-vision, you may specify either text only, text and up to 16 images, or text and 1 video clip. The token limit is 16,384. Note: Gemini updated their limit on their website to significantly lower the 1.0 from 60 calls to 15 calls a couple days ago. Gemini limit: https://ai.google.dev/gemini-api/docs/models/gemini#rate-limits https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini#:~:text=The%20token%20limit%20is%2032%2C760,%2C%20video%2C%20and%20audio%20files. https://cloud.google.com/vertex-ai?hl=en

Image