Flutter Community

Using Generative AI with Flutter

thumbnail

Background

  • Large Language Models (LLMs) have revolutionized natural language understanding and generation.
  • LLMs are based on neural networks and utilize word weights to determine the relevance of words in generating responses.
  • The google_generative_ai package is a wrapper for Google's generative AI APIs, supporting models like Gemini and legacy models like PaLM.

Using the google_generative_ai package

  • Get an API key for the Gemini API before using the package.
  • Configure the model by specifying the API key and the desired AI model.
  • Parameters like temperature settings control how the model generates responses for specific prompts.
  • Safety settings can be adjusted to ensure appropriate outputs from the model.

Text to Text Generation

  • Text to text generation involves providing a prompt as input and receiving generated text as output.
  • Use a model suited for text to text generation, like Gemini Pro, to generate responses based on prompts.
  • Pass safety settings and generation configurations to the API request for customizing the output.

Multimodal Generation

  • Multimodal generation combines different types of data to generate outputs.
  • Utilize the google_generative_ai package to generate responses from multimodal inputs.