Created
December 11, 2022 04:03
-
-
Save chuongmep/91e24e3976e44b2d39286a9cd7f90b4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "import os\n", | |
| "import openai\n", | |
| "\n", | |
| "openai.api_key = \"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\"\n", | |
| "\n", | |
| "response = openai.Completion.create(\n", | |
| " model=\"text-davinci-003\",\n", | |
| " prompt=\"The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and very friendly.\\n\\nHuman: Hello, who are you?\\nAI: I am an AI created by OpenAI. How can I help you today?\\nHuman: I'd like to cancel my subscription.\\nAI:\",\n", | |
| " temperature=0.9,\n", | |
| " max_tokens=150,\n", | |
| " top_p=1,\n", | |
| " frequency_penalty=0.0,\n", | |
| " presence_penalty=0.6,\n", | |
| " stop=[\" Human:\", \" AI:\"]\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "<OpenAIObject text_completion id=cmpl-6M7PF8GCBhEdJonHi38oFnYTlLkxE at 0x1fd67de9ee0> JSON: {\n", | |
| " \"choices\": [\n", | |
| " {\n", | |
| " \"finish_reason\": \"stop\",\n", | |
| " \"index\": 0,\n", | |
| " \"logprobs\": null,\n", | |
| " \"text\": \" Certainly. Please provide me with your account information so that I can help you with the cancellation process.\"\n", | |
| " }\n", | |
| " ],\n", | |
| " \"created\": 1670729705,\n", | |
| " \"id\": \"cmpl-6M7PF8GCBhEdJonHi38oFnYTlLkxE\",\n", | |
| " \"model\": \"text-davinci-003\",\n", | |
| " \"object\": \"text_completion\",\n", | |
| " \"usage\": {\n", | |
| " \"completion_tokens\": 20,\n", | |
| " \"prompt_tokens\": 66,\n", | |
| " \"total_tokens\": 86\n", | |
| " }\n", | |
| "}" | |
| ] | |
| }, | |
| "execution_count": 4, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "response" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3.10.0 64-bit", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython3", | |
| "version": "3.10.0" | |
| }, | |
| "orig_nbformat": 4, | |
| "vscode": { | |
| "interpreter": { | |
| "hash": "ec8507a9d0d51557069ff9e910ec47822a40c04209a5f1a2da16428a37fdf4db" | |
| } | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment