我正在使用AzureOpenAI和langchain,经常被PermissionError
击中。这主要是由于代理,但有人可以请检查代码--
from langchain.llms import OpenAI, AzureOpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
llm = AzureOpenAI(openai_api_type="", openai_api_base="", deployment_name="", model_name="", openai_api_key="", openai_api_version="")
template = """"
Translate the following text from {source_lang} to {dest_lang}: {source_text}
"""
prompt_name = PromptTemplate(input_variables=["source_lang", "dest_lang", "source_text"], template=template)
chain = LLMChain(llm=llm, prompt=prompt_name)
chain.predict(source_lang="English", dest_lang="Spanish", source_text="How are you?")
chain(inputs={"source_lang": "English", "dest_lang": "Spanish", "source_text": "How are you"})
字符串
我还尝试了额外的openai_proxy
参数,但运气不佳。
1条答案
按热度按时间to94eoyn1#
x1c 0d1x的数据
你的代码运行顺利!下面是我的LLM配置。其他变量用
.env
设置字符串