赞
踩
1.先安装g4f
pip install g4f
2.main.py运行
- from g4f.client import Client
- client = Client()
-
- def answer(question: str) -> str:
- response = client.chat.completions.create(
- model="gpt-4o",
- messages=[{"role": "user", "content": question}],
- )
- return response.choices[0].message.content
-
-
- def main():
- while True:
- question = input('\n请输入问题 > ')
- print(answer(question))
-
-
- if __name__ == '__main__':
- main()
3.运行结果
4.可能会出现报错问题,重新运行一下就可以了。
后续可能还会补充。。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。