Skip to content

Commit

Permalink
Añadido Excel con resultados de prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosooli committed Mar 23, 2023
1 parent 0487afd commit f4ca49b
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 4 deletions.
Binary file added openai_api/docs/prompt_history.xlsx
Binary file not shown.
115 changes: 111 additions & 4 deletions openai_api/prueba_openai_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,126 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# Librerias requeridas:\n"
"# Librerias requeridas:\n",
"import os\n",
"import openai"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# Global variables:\n",
"API_KEY = \"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\"\n",
"# openai.api_key = os.getenv(API_KEY)\n",
"openai.api_key = API_KEY"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"content\": \"\\n\\nClaro, hablo espa\\u00f1ol con fluidez. \\u00bfEn qu\\u00e9 te puedo ayudar?\",\n",
" \"role\": \"assistant\"\n",
"}\n"
]
}
],
"source": [
"completion = openai.ChatCompletion.create(\n",
" model=\"gpt-3.5-turbo\",\n",
" messages=[\n",
" {\"role\": \"user\", \"content\": \"Podemos pasar a hablar español?\"}\n",
" ]\n",
")\n",
"\n",
"print(completion.choices[0].message)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"Claro, hablo español con fluidez. ¿En qué te puedo ayudar?\n"
]
}
],
"source": [
"texto = \"\\n\\nClaro, hablo espa\\u00f1ol con fluidez. \\u00bfEn qu\\u00e9 te puedo ayudar?\"\n",
"texto_procesado = texto.encode('utf-8').decode('utf-8')\n",
"print(texto_procesado)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"Claro, hablo español con fluidez. ¿En qué te puedo ayudar?\n"
]
}
],
"source": [
"print(u\"\\n\\nClaro, hablo espa\\u00f1ol con fluidez. \\u00bfEn qu\\u00e9 te puedo ayudar?\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.10 ('fever_technical_asj': venv)",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"orig_nbformat": 4
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "cd42b88907c03ef0eab52c098042680f26b177116f43374bf146703bc18f33c4"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
Expand Down
Empty file added openai_api/src/limpieza.py
Empty file.

0 comments on commit f4ca49b

Please sign in to comment.