$30 off During Our Annual Pro Sale. View Details »

CSC509 Lecture 14

CSC509 Lecture 14

Software Design
Services
(202412)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

November 22, 2025
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 508/9 Software Engineering (Design & Deployment) Lecture 14. Services
  2. What if …? 4 Box Name 1 Name 2 Cat

    Car What is a Flowchart diagram? _
  3. Open AI 2024 1. Go to the OpenAI website a

    t https://pl a tform.open a i.com/ a nd click on the "Sign Up" button in the top-right corner of the p a ge. 2.Follow the prompts to cre a te a n a ccount a nd verify your em a il a ddress. 3.Once you're logged in, click on your user photo a t the lower left corner of the p a ge a nd Then on the "API Keys" option in the d a shbo a rd menu. 4.In Project API Keys, Click on the ”Cre a te New Secret Key" button. 5.Enter a n a me for your API key a nd select the API permissions you w a nt to gr a nt to the key. 6.Click the "Cre a te" button to gener a te your new key. 9
  4. Note • St a rting from M a rch 25,

    2024, OpenAI implemented a new billing method for the OpenAI API a ccounts. Inste a d of receiving a bill a t the end of e a ch month, users must pre-purch a se credits to use the API vi a the billing p a ge. • J a nu a ry 2024 (GTP-35): • Input Tokens: $0.0015 per 1,000 tokens • Output Tokens: $0.002 per 1,000 tokens • Tokens: Tokens c a n be a s short a s one ch a r a cter or a s long a s one word Typic a lly, 1,000 tokens is a bout 750 words. 10
  5. JSON Response {"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 } } 21
  6. Properties File • Cre a te a new f ile

    in your resource's directory (usu a lly src/m a in/resources in a M a ven project) a nd n a me it for ex a mple con f ig.properties (or a ny n a me you prefer). • Add the properties you need in this f ile. 23
  7. Properties This f ile should not be committed to your

    version control system if it cont a ins sensitive inform a tion like API keys. Advice: • Cre a te a copy of your con f ig.properties f ile a nd n a me it con f ig.s a mple.properties. Repl a ce the sensitive d a t a like the API key with pl a ceholder v a lues. • Add con f ig.properties to your .gitignore f ile. This will prevent the a ctu a l properties f ile from being tr a cked by Git. • Commit the con f ig.s a mple.properties f ile to your repository. This will provide a templ a te for other developers to know wh a t keys/v a lues a re expected in the a ctu a l con f ig.properties f ile. 25
  8. CSC 509 Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2025

    Copyright. These slides can only be used as study material for the class CSC509 at Cal Poly. They cannot be distributed or used for another purpose.