AI智能问答系统

from openai import OpenAI

# 创建 OpenAI 客户端
client = OpenAI(
    api_key="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",
    base_url="https://integrate.api.nvidia.com/v1"
)

# 预定义一组常见问题及其答案
faq = {
    "What is the capital of France?": "The capital of France is Paris.",
    "What is the largest ocean on Earth?": "The largest ocean is the Pacific Ocean.",
    "What is the highest mountain in the world?": "The highest mountain is Mount Everest.",
    "Who wrote 'Romeo and Juliet'?": "William Shakespeare wrote 'Romeo and Juliet'.",
}

print("欢迎使用问答系统!你可以询问我一些常见问题。输入 '退出' 来结束对话。")

while True:
    user_input = input("请输入你的问题:")

    if user_input.lower() == '退出':
        print("感谢使用,再见!")
        break

    # 生成用户问题的嵌入表示
    response = c
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值