Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)
OpenAssistant Conversations (oasst2)
Write the php function getrequestorpreferred_language(), which gets the language of the…
In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
- User
Write the php function get_requestor_preferred_language(), which gets the language of the user calling the page. It should return one of "es" "de" "en" "fr" "zh" "jp" and use "en" as a fallback if it is none of them
- Assistant
Sure, here is the function:
/** * Returns the language of the user calling the page * * @return $lang Language of the user if in a white list (default "en") * * @ref https://stackoverflow.com/questions/3770513/detect-browser-language-in-php */ function get_requestor_preferred_language() { $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); $acceptLang = ["es", "de", "en", "fr", "zh", "jp"]; $lang = in_array($lang, $acceptLang) ? $lang : "en"; return $lang; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →