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

CSC309 Lecture 17

CSC309 Lecture 17

Software Engineering II
Connecting Services III
(202405)

Javier Gonzalez-Sanchez

February 21, 2023
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs CSC 309 Software Engineering II Lecture 17: Connecting Services

    III Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227
  2. jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 |

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

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

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

    14 We need keys String key = "XYZabc123259#$%#$Fcaskjhdux_2342445Calp";
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. jgs Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 |

    25 https://github.com/CSC3100/Cloud-Services Github
  12. 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]
  13. jgs

  14. jgs CSC 309 Software Engineering II Lab 17: Work in

    your Sprint Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.com Building 14 -227
  15. 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.