Python · Python AI 实战教程
构建第一个 AI 小应用
本教程共 2 篇 · 第 2 篇
我们用几行代码把大模型能力接进 Python。
一、调用示例
import requests
resp = requests.post(
'https://api.example.com/v1/chat',
json={'prompt': '用一句话介绍 Python'},
headers={'Authorization': 'Bearer YOUR_KEY'},
)
print(resp.json())
二、下一步
把返回结果渲染到网页或命令行,就是一个最小可用的 AI 应用了。
上一篇
用 Python 做 AI 的准备
下一篇
已经是最后一篇啦