-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
059c2b2
commit 5cf7501
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import openai | ||
from typing import Literal | ||
|
||
|
||
optional_models = Literal['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4', 'gpt-4-32k'] | ||
def call_gpt(prompt: str, api_key: str, model: optional_models='gpt-3.5-turbo') -> str: | ||
openai.api_key = api_key | ||
completion = openai.ChatCompletion.create( | ||
model=model, | ||
messages=[{"role": "user", "content": prompt}] | ||
) | ||
return completion.choices[0].message.content |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
|
||
|
||
def set_proxy(port: int=7890): | ||
os.environ["http_proxy"] = f"http://127.0.0.1:{port}" | ||
os.environ["https_proxy"] = f"http://127.0.0.1:{port}" | ||
|
||
def unset_proxy(): | ||
os.environ.pop("http_proxy") | ||
os.environ.pop("https_proxy") | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
setup( | ||
name="myutils", | ||
version="1.0", | ||
version="1.0.1.dev", | ||
author="Vichayturen", | ||
author_email="[email protected]", | ||
description="", | ||
|
@@ -11,7 +11,8 @@ | |
url="", | ||
# 表明当前模块依赖哪些包,若环境中没有,则会从pypi中下载安装 | ||
install_requires=[ | ||
'pandas' | ||
'pandas', | ||
'openai' | ||
], | ||
# 你要安装的包,通过 setuptools.find_packages 找到当前目录下有哪些包 | ||
packages=find_packages() | ||
|