Comments (2)
去看content文件夹中的Notebook文件,应该就是把一些功能函数封装了,比如:
# 一个封装 OpenAI 接口的函数,参数为 Prompt,返回对应结果
def get_completion(prompt, model="gpt-3.5-turbo"):
'''
prompt: 对应的提示词
model: 调用的模型,默认为 gpt-3.5-turbo(ChatGPT),有内测资格的用户可以选择 gpt-4
'''
messages = [{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=0, # 模型输出的温度系数,控制输出的随机程度
)
# 调用 OpenAI 的 ChatCompletion 接口
return response.choices[0].message["content"]
from llm-cookbook.
建议最好阅读 content 目录下的 Notebook 文件,可以直接复现;我们在在线阅读为保证阅读便利性,将一些重复使用的函数封装为了本地 tool 包
from llm-cookbook.
Related Issues (20)
- 文档错误,env文件不应该写双引号 HOT 2
- 函数参数有误 HOT 3
- HF_API_TTI_BASE and HF_API_TTI_BASE HOT 1
- 文本扩展中的定制客户邮件部分存在明显错误
- ffprobe and ffmpeg工具找不到的问题
- 告诉我华为公司生产的GT Watch运动手表的相关信息案例不正确 HOT 1
- chapter 5 to 7 missing
- 在线文档失效了 HOT 3
- 请问选修课的内容什么时候会有呀 HOT 1
- ModuleNotFoundError: No module named 'context_locals' HOT 1
- 必修三第7个文档代理 HOT 1
- 超链接错误 HOT 1
- from tool import get_completion HOT 1
- PDF 下载链接 404 HOT 1
- from tool import get_completion HOT 1
- 建议做成在线可以访问版本 HOT 1
- Prompt engineering for developers 教程校对与精翻流程更新
- 观看视频 HOT 1
- 太阳能发电站问题 Prompt 更新 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llm-cookbook.