Slide 1

Slide 1 text

jgs CSC 309 Software Engineering II Lecture 17: Connecting Services III Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227

Slide 2

Slide 2 text

jgs Previously

Slide 3

Slide 3 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 3 Pong

Slide 4

Slide 4 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 4 Pong

Slide 5

Slide 5 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 5 https://github.com/CSC3100/Pong-Game Github

Slide 6

Slide 6 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 6 PongGameServer

Slide 7

Slide 7 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 7 Server

Slide 8

Slide 8 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 8 PongBrain

Slide 9

Slide 9 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 9 PongData

Slide 10

Slide 10 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 10 PongGameClient

Slide 11

Slide 11 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 11 https://github.com/CSC3100/Pong-Game Github

Slide 12

Slide 12 text

jgs One Last API

Slide 13

Slide 13 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 13 What if …? Box Name 1 Name 2 Cat Car What is a Flowchart diagram? _

Slide 14

Slide 14 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 14 We need keys String key = "XYZabc123259#$%#$Fcaskjhdux_2342445Calp";

Slide 15

Slide 15 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 15 1.Go to the OpenAI website at https://platform.openai.com/ and click on the "Sign Up" button in the top-right corner of the page. 2.Follow the prompts to create an account and verify your email address. 3.Once you're logged in, click on your user photo at the lower left corner of the page and Then on the "API Keys" option in the dashboard menu. 4.In Project API Keys, Click on the ”Create New Secret Key" button. 5.Enter a name for your API key and select the API permissions you want to grant to the key. 6.Click the "Create" button to generate your new key. Open AI 2024

Slide 16

Slide 16 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 16 § Starting from March 25, 2024, OpenAI implemented a new billing method for the OpenAI API accounts. Instead of receiving a bill at the end of each month, users must pre-purchase credits to use the API via the billing page. • January 2024 (GTP-35): • Input Tokens: $0.0015 per 1,000 tokens • Output Tokens: $0.002 per 1,000 tokens • Tokens: Tokens can be as short as one character or as long as one word Typically, 1,000 tokens is about 750 words. Note

Slide 17

Slide 17 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 17 (

Slide 18

Slide 18 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 18 § Create a new file in your resource's directory (usually src/main/resources in a Maven project) and name it for example config.properties (or any name you prefer). § Add the properties you need in this file. Properties File

Slide 19

Slide 19 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 19 Properties

Slide 20

Slide 20 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 20 This file should not be committed to your version control system if it contains sensitive information like API keys. Advice: § Create a copy of your config.properties file and name it config.sample.properties. Replace the sensitive data like the API key with placeholder values. § Add config.properties to your .gitignore file. This will prevent the actual properties file from being tracked by Git. § Commit the config.sample.properties file to your repository. This will provide a template for other developers to know what keys/values are expected in the actual config.properties file. Properties

Slide 21

Slide 21 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 21 )

Slide 22

Slide 22 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 22 Chatbot

Slide 23

Slide 23 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 23 Chatbot

Slide 24

Slide 24 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 24 {"id":"cmpl78QWL0xfnaEHWzTuCJZhpBK3OshrR", "object":"text_completion", "created":1682242925, "model":"gpt-3.5-turbo-instruct", "choices":[{ "text":"ANSWER TEXT HERE", "index":0, "logprobs":null, "finish_reason":"stop" }], "usage":{ "prompt_tokens":1, "completion_tokens":76, "total_tokens":77 } } JSON Response

Slide 25

Slide 25 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 25 https://github.com/CSC3100/Cloud-Services Github

Slide 26

Slide 26 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 26 ChatbotMain

Slide 27

Slide 27 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 27 ChatbotPanel

Slide 28

Slide 28 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 28 ChatbotBrain

Slide 29

Slide 29 text

jgs Javier Gonzalez-Sanchez | CSC 308 | Winter 2023 | 29

Slide 30

Slide 30 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 30 Questions

Slide 31

Slide 31 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 31 Office Hours Tuesday and Thursday 3 - 5 pm But an appointment required Sent me an email – [email protected]

Slide 32

Slide 32 text

jgs

Slide 33

Slide 33 text

jgs CSC 309 Software Engineering II Lab 17: Work in your Sprint Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227

Slide 34

Slide 34 text

jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 34 Let’s Work

Slide 35

Slide 35 text

jgs CSC 309 Software Engineering II Javier Gonzalez-Sanchez, Ph.D. [email protected] Spring 2024 Copyright. These slides can only be used as study material for the class CSC309 at Cal Poly. They cannot be distributed or used for another purpose.