Dino Geek, try to help you

How to format ChatGPT responses?


The standard formatting for generating a response from ChatGPT is a list of messages, each of which includes a ‘role’ and ‘content’. Here’s a minimal example:

```
messages = [ {“role”: “system”, “content”: “You are ChatGPT, a large language model.”}, {“role”: “user”, “content”: “Who won the world series in 2020?”},
]
response = openai.ChatCompletion.create( model=“gpt-3.5-turbo”, messages=messages
)
```

The ‘role’ field can be one of three values: ‘system’, ‘user’, and ‘assistant’. Typically, a conversation begins with a ‘system’ role to set the behavior of the assistant, followed by alternating ‘user’ and ‘assistant’ messages. The ‘user’ role denotes an instruction from the user, while the ‘assistant’ role denotes what the assistant previously said.

The content of a ‘system’ message is a special instruction that guides the model’s behavior, a ‘user’ message contains a user’s instruction to the assistant, and an ‘assistant’ message holds the model’s previous responses.

The ‘model’ parameter determines which version of GPT you want to use. As of March 1, 2023, `gpt-3.5-turbo` is recommended for most use cases.

After running the code, the assistant’s reply can be extracted with `response[‘choices’]0[‘message’][‘content’]`.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use