Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
angelluce committed Mar 26, 2023
0 parents commit c67b37b
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# python cache
/__pycache__

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

# Firebase
.firebase
*-debug.log
.runtimeconfig.json
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
![ChatGPT](/assets/chatgpt.png "ChatGPT")

# ChatGPT

Este proyecto está desarrollado en `Python` con fines educativos utilizando la API de ChatGPT.



## Documentación

Revisar la documentación oficial en los siguientes enlaces:

- Documentación API ChatGPT: https://platform.openai.com/docs/api-reference/chat
- Módulo OpenAI: https://github.com/openai/openai-python



## Instalación

Instalar Flask en el proyecto utilizando el comando `pip install openai`



## Ejecución

Ejecutar el proyecto utilizando el comando `python app.py`



## Autor

Este proyecto fue desarrollado por [Angel Lucero](https://github.com/angelluce)
22 changes: 22 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import openai

openai.api_key = "CHAT_GPT_KEY"

messages = [{"role": "system","content": "Eres un asistente muy útil"}]

while True:
content = input("¿De qué quieres hablar?")

if content == "salir":
break

messages.append({"role": "user", "content": content })

response = openai.ChatCompletion.create(model="gpt-3.5-turbo",
messages=[{"role": "user", "content": content}])

response_content = response.choices[0].message.content

messages.append({"role": "assistant", "content": response_content })

print(response_content)
Binary file added assets/chatgpt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"choices": [{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "string",
"role": "string"
}
}],
"created": 1679776746,
"id": "string",
"model": "string",
"object": "string",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0
}
}

0 comments on commit c67b37b

Please sign in to comment.