The repo is my practice playground for learning openai api. when using each py file, be careful about the rate limit policy from openai.
I use python3 (v3.9.13) and pip3 (v23.1.2)
pip3 install load_dotenv
pip3 install openai
- best strategies
- usage example
- LEARN GENERATIVE AI Short Courses in https://www.deeplearning.ai
- https://platform.openai.com/tokenizer
-
Chat completions
vsCompletions
?- Completions takes a single string as input, however chat completions is given dialog and response the result with specfic format.
- chat completions using a list of messages; completions use a freeform text string called prompt.
-
role system vs assistant vs user
- system -> used to guide the assistant's behavior or tone, e.g.:
{'role':'system', 'content': 'You are an assistant that speaks like Shakespeare.'} {'role':'system', 'content': 'You are a helpful assistant.'} {'role':'system', 'content': 'All your response must use emoji'}
- assistant -> LLM response
- user -> prompt