The maximum length for the "role" field in the OpenAI API is quite limited. Specifically, the "role" field can only be one of the following values: "system", "user", or "assistant". These values are case-sensitive and must be provided exactly as shown.
Here’s a quick summary:
"system": Used for setting the behavior of the assistant.
"user": Represents the input from the user.
"assistant": Represents the response from the model.
Each of these role values has a fixed length and is limited to the exact string mentioned. There is no provision for custom roles or longer strings in the "role" field.
If you need to convey more complex information or context, you should include it in the "content" field of the message, which has a more generous character limit. The total context window for the API (which includes all messages in the conversation) is typically around 4096 tokens, depending on the model you are using.
User
En php, comment ne retourner que les chiffres d'un string ?
Assistant
Pour extraire uniquement les chiffres d'une chaîne de caractères en PHP, vous pouvez utiliser plusieurs méthodes. Voici quelques-unes des approches les plus courantes :
1. Utilisation de preg_replace
La fonction preg_replace avec une expression régulière est une méthode très efficace pour retirer tous les caractères non numériques.
Toutes ces méthodes sont efficaces, mais l'utilisation de preg_replace est généralement la plus concise et la plus lisible pour cette tâche spécifique.