79296230

Date: 2024-12-20 05:04:04
Score: 0.5
Natty:
Report link

I tried out your code snippets and specify package version. seems working fine in my end.

enter image description here

"dependencies": { "@azure/openai": "^2.0.0-beta.2", "openai": "^4.62.1" }

import { AzureOpenAI } from "openai";
import "@azure/openai/types";

const deployment = "gpt-4o";
const apiVersion = "2024-08-01-preview";
const apiKey = "xxxxx";
const endpoint = "https://xxxxx.openai.azure.com"; // Add your endpoint here
const options = { deployment, apiVersion, apiKey, endpoint }
const client = new AzureOpenAI(options);

const messages = [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Tell me a joke." }
  ];

const response = await client.chat.completions.create({
    model: '',
    messages,
    data_sources: [
      {
        type: "azure_search",
        parameters: {
          endpoint: "XXXX",
          index_name: "YYYY",
          authentication: {
            type: "system_assigned_managed_identity",
          },
        },
      },
    ]
  });
  

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: qkfang