Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build with AI - Get started with the Gemini API

Build with AI - Get started with the Gemini API

A companion slide deck to Get started with the Gemini API code lab: https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=python

Presented at Build with AI - Bangkok event
19 May 2024

Kamolphan Liwprasert

May 19, 2024
Tweet

More Decks by Kamolphan Liwprasert

Other Decks in Programming

Transcript

  1. Get started with the Gemini API Bangkok Cloud • Fon

    - Kamolphan Liwprasert GDE Cloud, WTM Ambassador
  2. Customer support Website navigation Virtual digital assistants Document/ media search,

    synthesis Device support Employee assistance Market research Conversational commerce and personalized recommendations Generative AI powers a multitude of use cases
  3. Generative AI is driving new opportunities Operational efficiencies, cost savings,

    and value creation Improve time-to-value to search, navigate, and extract insights and understanding from large amounts of complex data Complex data, intuitively accessible Improve customer experience, reaching larger client bases by making online interactions more natural, conversational, and rewarding Online interactions made conversational Generate text, code, image, video, or music quickly and multi-modally, speeding up every business processes and maximizing employee productivity Content generation at the click of a button Customize large models and incorporate state of the art generative capabilities natively into your own internal ML operational platforms Customize Foundation models Analyst Customer Service Creative AI Practitioner
  4. Vertex AI Generative AI with Google I want to use

    Gen AI w/ Google Gemini (Bard) Foundational Models AI Studio / Gemini API Google Cloud Foundation Models Model Garden Search Conversation as a consumer as a developer for prototyping enterprise level privacy, security, scalability https://gemini.google.com/ https://aistudio.google.com/
  5. Codelabs Objectives This codelabs will allow us to understand the

    basics on how to use the Python SDK for the Gemini API. We will explore these tasks: • Set up your development environment and API access to use Gemini • Generate text responses from text inputs • Generate text responses from multimodal inputs (text and images) • Use Gemini for multi-turn conversations (chat) • Explore advanced use cases
  6. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  7. Bangkok Cloud • aistudio.google.com Project Setup: API Key 🔑 How

    to get API key (detailed) https://bit.ly/aistudio-api-key aistudio.google.com
  8. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  9. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  10. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  11. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  12. Cosine Similarity คือ องศาระ วาง Vector (ในที่นี้คือ embedding) มีคาระ วาง

    [-1, 1] จากนิยาม เรา ามารถคำนวณ Cosine Similarity ของ 2 vector ไดโดยคำนวณ Dot product (np.dot) เปรียบเทียบ Embedding ด้วย Cosine Similarity ที่มา PyImageSearch และ https://en.wikipedia.org/wiki/Cosine_similarity cosine_similarity = np.dot(v, w) / (np.linalg.norm(v) * np.linalg.norm(w)) ~ 1 ~ -1 ~ 0
  13. Bangkok Cloud • bit.ly/gemini-api-lab Generate text from text inputs 1

    Generate text from image & text inputs 2 Chat conversation 3 Tokens & Embeddings 4 Advance Use Case and Settings 5
  14. Additional Gemini (Python) Resources: • Gemini API Cookbook - https://bit.ly/gemini-api-cookbook

    • Model Tuning - https://bit.ly/tuning-quickstart-python • Function Calling - https://bit.ly/function-calling-python-quickstart • Document search - https://bit.ly/doc-search-embeddings • Prompt Design Strategies - https://bit.ly/prompt-design-strategies