提问人:CUiD8pdQJh 提问时间:11/8/2023 最后编辑:CUiD8pdQJh 更新时间:11/8/2023 访问量:46
Teams-AI 库:尝试连接到我的 Azure OpenAI 资源时出现“请求失败,状态代码为 400”
Teams-AI Library: Getting "Request failed with status code 400" while trying to connect to my Azure OpenAI Resource
问:
目前,在向使用 teams-ai 和 botbuilder 模块创建的 Teams-Bot 发送消息时,我收到以下响应:
The bot encountered unhandled error: Request failed with status code 400
To continue to run this bot, please fix the bot source code.
当我检查抛出的错误时,这是响应数据:,这是响应 statusText: 。我找不到尸体,这可能是问题的一部分,也可能不是。"Unsupported data type\n"
"model_error"
我试图找到问题的根源,这可能是将要发送的数据准备好并附加到我的 Azure OpenAI 部署请求的地方,但到目前为止,我还没有运气。
这是我在代码中实现 Azure OpenAI 部署的方式:
const planner = new AzureOpenAIPlanner({
apiKey: process.env.AZUREOPENAIKEY,
defaultModel: '{name-of-deployment-in-azure}/chat',
endpoint: process.env.AZUREOPENAIENDPOINT,
apiVersion: '2023-07-01-preview'
});
const promptManager = new DefaultPromptManager('C:/test123/prompts');
const storage = new MemoryStorage();
const app = new Application<ApplicationTurnState>({
storage,
ai: {
planner,
// moderator,
promptManager,
prompt: 'chat',
history: {
assistantHistoryType: 'text'
}
}
});
// Create HTTP server.
const server = restify.createServer();
server.use(restify.plugins.bodyParser());
server.listen(process.env.port || process.env.PORT || 3978, () => {
console.log(`\nBot Started, ${server.name} listening to ${server.url}`);
});
// Listen for incoming requests.
server.post("/api/messages", async (req, res) => {
await adapter.process(req, res, async (context) => {
await app.run(context);
});
});
答: 暂无答案
评论