Skip to content

Instantly share code, notes, and snippets.

View mouredev's full-sized avatar
:octocat:
Picando...

Brais Moure mouredev

:octocat:
Picando...
View GitHub Profile
@mouredev
mouredev / chatgpt_api.py
Created March 7, 2023 19:31
Ejemplo de uso del API de ChatGPT desde Python
import openai # pip install openai
import typer # pip install "typer[all]"
from rich import print # pip install rich
from rich.table import Table
"""
Webs de interés:
- Módulo OpenAI: https://github.com/openai/openai-python
- Documentación API ChatGPT: https://platform.openai.com/docs/api-reference/chat
- Typer: https://typer.tiangolo.com
@mouredev
mouredev / chatgpt.py
Last active March 22, 2024 11:55
Ejemplo de uso de ChatGPT desde Python
import openai
# Tutorial en vídeo: https://youtu.be/1Pl1FWHKHXQ
# Genera una API Key desde https://openai.com/api
openai.api_key = "TU_API_KEY"
while True:
prompt = input("\nIntroduce una pregunta: ")