Let customers extend your database with code.
Riza lets you run user-defined functions from multiple customers
in a secure sandbox embedded in your database.
-- Translate into Spanish SELECT translate_text('Hello there!', 'es')
1from openai import OpenAI
2
3client = OpenAI()
4
5def translate_text(text, lang):
6 msg = f"Translate the following text into {lang}: {text}\n"
7 response = client.chat.completions.create(
8 model="gpt-3.5-turbo",
9 prompt=msg,
10 )
11 return response.choices[0].text.strip()
12
--- translate_text ---------------- ¡Hola! (1 row) ---