Engenharia rápida com a API OpenAI
Fouad Trad
Machine Learning Engineer

prompt = "Generate an Excel sheet containing
five student names and their grades"
print(get_response(prompt))
Desculpa, mas como uma IA baseada em texto,
não consigo gerar diretamente uma planilha do Excel.
Posso, no entanto, te ajudar a criar uma
representação de exemplo dos dados solicitados.
prompt = "Generate a table that I can copy
to Excel, containing five student names and
their grades"
print(get_response(prompt))
| Nome do aluno | Nota |
|---------------|------|
| Aluno 1 | 90 |
| Aluno 2 | 85 |
| Aluno 3 | 95 |
| Aluno 4 | 88 |
| Aluno 5 | 92 |
code = '''
def calculate_rectangle_area(length, width):
area = length * width
return area
'''

prompt = f"""
Analyze the code delimited by triple backticks with one sentence
```{code}```.
"""
print(get_response(prompt))
O código calcula a área de um retângulo com base no comprimento e na largura.
Ajustamos o prompt para obter a linguagem de programação
prompt = f"""
Analyze the code delimited by triple backticks and provide its programming
language with one sentence
```{code}```.
"""
print(get_response(prompt))
O código fornecido é uma função em Python que calcula a área de um
retângulo com base no comprimento e na largura.
Ajustamos o prompt para obter saída estruturada
prompt = f"""
For the function delimited by triple backticks, provide in a structured format
the following:
- description: one sentence short description
- language: the programming language used
- input: the inputs to the function
- output: the output returned by the function
```{code}```.
"""
print(get_response(prompt))
description: Esta função calcula a área de um retângulo.
language: Python
input:
- length: O comprimento do retângulo.
- width: A largura do retângulo.
output:
- area: A área calculada do retângulo, que é o produto de comprimento
e largura.
Prompt inicial
prompt = """
Clear skies and a gentle breeze. -> Sunny
Heavy rain and thunderstorms expected. -> Rainy
Fresh snowfall with freezing temperatures. ->
"""
print(get_response(prompt))
Snowy
Prompt inicial
prompt = """
Clear skies and a gentle breeze. -> Sunny
Heavy rain and thunderstorms expected. -> Rainy
The wind of change brought a refreshing breeze to the company's operations. ->
"""
print(get_response(prompt))
Windy
Prompt refinado
prompt = """
Clear skies and a gentle breeze. -> Sunny
Heavy rain and thunderstorms expected. -> Rainy
The political climate in the country was stormy -> Unknown
The wind of change brought a refreshing breeze to the company's operations. ->
"""
print(get_response(prompt))
Unknown

Engenharia rápida com a API OpenAI