Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer…

Gemini Code Assist : Trying out prompts in local languages

--

Gemini Code Assist is my Code Assistant of choice when I am developing/building applications. While it supports several programming languages, I was curious to understand how well it would support local languages during prompting.

I thought of giving Gemini Code Assist a shot with local languages.

Do note that usually my mental process does use English itself to both think and prompt, so the examples that I am using might be contested as not being a natural way that someone in a language like Hindi or Marathi or Gujarati might think about. But I encourage you to try out Gemini Code Assist and check it out for yourself.

First up, there is an official mention on the web about the languages that are supported in Prompts. This is different from coding languages (Python, Java, Go, etc). Here you go:

My favourite example is often a web application in a specific language and web framework. Let’s go with Python Flask framework. I am going to try out various examples and see how Code Assist handles it.

Here’s my first prompt:

Generate a Python web application using the Flask Framework. 

It should demonstrate 3 routes:

1. Return a hard coded string
2. Parses the request parameters and returns back a value based on them.
3. Accepts a file that is uploaded and returns back a JSON object with file name and file size in bytes.

Explain the code to me in Marathi please.

What I am asking it to do is give me a boiler-plate Flask application that demonstrates 3 routes as given below. Notice that I have asked it to explain the code in a local language Marathi to me.

The choice of Marathi as a language is an interesting one. It is not listed as one of the supported languages in the documentation. I still wanted to give it a try to understand how well it would do that.

I get back the following response. Multiple screenshots are given below:

Screenshot 1/3 : Code explanation is in Marathi.
Screenshot 2/3 : There is a bit of Marathi in there in the 1st route.
Screenshot 3/3 : More of the code explanation

The next thing that I want to do is generate a new route in the web application. But this time, I would like to specify the prompt in Marathi. So I give it the following prompt:

आणखी एक "मार्ग" जोडा जो स्ट्रिंग पॅरामीटर स्वीकारतो आणि मजकूर प्रतिसाद परत पाठवतो 
जो त्या पॅरामीटर मूल्याच्या उलट आहे.

For those of you, who are not familiar with Marathi, this prompt when roughly translated in English is:

Add one more route that accepts a string parameter 
and returns back a result that a reverse of that value.

This is the result that I got back:

Screenshot 1/2

and

Screenshot 2/2

You can notice that it has once again thrown in some Marathi text into the code in the response text. So a few things to iron out, maybe via better prompts or providing specific instructions but this looks like good support to me.

Just for reference, if I gave the very first prompt completely in Hindi (another language) and did not specify any language preference for code or code explanation, as given below:

फ्लास्क फ्रेमवर्क का उपयोग करके एक पायथन वेब एप्लिकेशन जेनरेट करें। इसमें 3 रूट प्रदर्शित होने चाहिए:

1. हार्ड कोडेड स्ट्रिंग लौटाएँ
2. अनुरोध पैरामीटर को पार्स करें और उनके आधार पर एक मान लौटाएँ।
3. अपलोड की गई फ़ाइल को स्वीकार करें और बाइट्स में फ़ाइल नाम और फ़ाइल आकार के साथ JSON ऑब्जेक्ट लौटाएँ।

I get the following results:

Screenshot 1/2
Screenshot 2/2

Let me know what you think of this? How do you see yourself mixing English and your local language at times, to get the most out of Code Assistants.

Try out a supported language in your prompts. My experience with a non-supported language indicates clearly that results with supported languages would be on par with one’s expectations. Please drop your comments and let me know about your experience.

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Romin Irani
Romin Irani

Written by Romin Irani

My passion is to help developers succeed. ¯\_(ツ)_/¯

No responses yet