Return identified language in GPT API response

Hi, I’ve been working with assistants since the beginning and it’s working for me. However, lately, I have tried to get the language the user uses to talk to the GPT and I couldn’t find anything related to that in the documentation.
I’m not talking about Whisper, but the GPT assistants API.

I have checked the forum and didn’t see any topic related. There’s a way to get the user language? I’ve tried to create a function to be called when the user changes the language, but it didn’t work fine and it’s kind of annoying.

If possible get the language from the return message on the assistant API it would be better.

thanks in advance

Nothing in the AI actually decides upon or has to switch languages. There’s no decision or determination made - the AI just has the ability to be multilingual from pretraining.

Did some nerds in California focus time on a language spoken by about as many people as the population of California?

So the solution is to ask another language model API call. You are the one sending the user message to Assistants, so you can ask before you send the message and even add it as message metadata if you want the thread to keep track for you.

1 Like

Thank you.
Since Whisper (at least whisper from GitHub) returns the spoken language, I thought it couldn’t be so difficult to get from GPT.
So it’s better to use some Python package to detect the language, right?
Or maybe using the assistant, however, the token consumption is already large enough.

Here’s an example language model call:

If you can avoid paying for AI and do it fast in Python by keyword statistics, if a library exists (and I don’t know 1000 libraries…) more power to you.

Embeddings AI may not be ideal, as models can now look across languages and return similar semantics for the meaning within.

edit: my system prompt might work better with correct info: Japanese is ja

1 Like