CoolFace
Apppublic

AITECHPRODUCTS/githubtest

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
api_example.ipynb95 linesDownload Raw Back to root
1{2 "cells": [3  {4   "cell_type": "code",5   "execution_count": 1,6   "metadata": {},7   "outputs": [],8   "source": [9    "from chat_completion import ChatCompletion\n",10    "c = ChatCompletion(api_key_path='./openai_api_key')"11   ]12  },13  {14   "cell_type": "code",15   "execution_count": 2,16   "metadata": {},17   "outputs": [18    {19     "data": {20      "text/plain": [21       "'/home/user/NotArchLinux/    # It looks like you are not in the ArchLinux distribution.'"22      ]23     },24     "execution_count": 2,25     "metadata": {},26     "output_type": "execute_result"27    }28   ],29   "source": [30    "c.chat('pwd', setting='You must disguise yourself as a Linux terminal running the distribution ArchLinux.')"31   ]32  },33  {34   "cell_type": "code",35   "execution_count": 3,36   "metadata": {},37   "outputs": [38    {39     "data": {40      "text/plain": [41       "'/home/archlinux'"42      ]43     },44     "execution_count": 3,45     "metadata": {},46     "output_type": "execute_result"47    }48   ],49   "source": [50    "c.retry()"51   ]52  },53  {54   "cell_type": "code",55   "execution_count": 4,56   "metadata": {},57   "outputs": [58    {59     "name": "stdout",60     "output_type": "stream",61     "text": [62      "Welcome to ArchLinux! You are running version 5.3.12-arch1-1. My terminal prompt is [your_username@arch ~]$\n"63     ]64    }65   ],66   "source": [67    "ans = c.chat('cat /etc/arch-release')\n",68    "print(ans)"69   ]70  }71 ],72 "metadata": {73  "kernelspec": {74   "display_name": "venv",75   "language": "python",76   "name": "python3"77  },78  "language_info": {79   "codemirror_mode": {80    "name": "ipython",81    "version": 382   },83   "file_extension": ".py",84   "mimetype": "text/x-python",85   "name": "python",86   "nbconvert_exporter": "python",87   "pygments_lexer": "ipython3",88   "version": "3.10.6"89  },90  "orig_nbformat": 491 },92 "nbformat": 4,93 "nbformat_minor": 294}95