Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

Cấu trúc đối tượng Azure OpenAI

Việc tích hợp Azure OpenAI Service vào ứng dụng của bạn cho phép bạn sử dụng liền mạch nhiều mô hình triển khai và khu vực được lưu trữ bởi Azure OpenAI. Phần này trình bày chi tiết cách cấu hình endpoint Azure OpenAI cho nhu cầu của bạn.

Để biết hướng dẫn chi tiết về cách thiết lập cấu hình Azure OpenAI, hãy nhấp vào đây

Cấu hình ví dụ

endpoints:
  azureOpenAI:
    titleModel: "gpt-4-turbo"
    groups:
      - group: "my-westus" # arbitrary name
        apiKey: "${WESTUS_API_KEY}"
        instanceName: "actual-instance-name" # name of the resource group or instance
        version: "2023-12-01-preview"
        # baseURL: https://prod.example.com
        # additionalHeaders:
        #   X-Custom-Header: value
        models:
          gpt-4-vision-preview:
            deploymentName: gpt-4-vision-preview
            version: "2024-02-15-preview"
          gpt-3.5-turbo:
            deploymentName: gpt-35-turbo
          gpt-3.5-turbo-1106:
            deploymentName: gpt-35-turbo-1106
          gpt-4:
            deploymentName: gpt-4
          gpt-4-1106-preview:
            deploymentName: gpt-4-1106-preview
      - group: "my-eastus"
        apiKey: "${EASTUS_API_KEY}"
        instanceName: "actual-eastus-instance-name"
        deploymentName: gpt-4-turbo
        version: "2024-02-15-preview"
        baseURL: "https://gateway.ai.cloudflare.com/v1/cloudflareId/azure/azure-openai/${INSTANCE_NAME}/${DEPLOYMENT_NAME}" # uses env variables
        additionalHeaders:
          X-Custom-Header: value
        models:
          gpt-4-turbo: true

Lưu ý: Endpoint Azure OpenAI hỗ trợ tất cả Shared Endpoint Settings, bao gồm streamRate, titleModel, titleMethod, titlePrompt, titlePromptTemplatetitleEndpoint.

assistants

Khóa:

KeyTypeDescriptionExample
assistantsBooleanBật hoặc tắt các trợ lý cho endpoint Azure OpenAI. Khi được đặt thành `true`, sẽ kích hoạt các trợ lý liên kết với endpoint này.Choose one, either the official OpenAI API or Azure OpenAI API for assistants, not both.

Mặc định: Không xác định

Ví dụ:

assistants: true

groups

Khóa:

KeyTypeDescriptionExample
groupsArrayCấu hình cho các nhóm model theo vị trí địa lý hoặc mục đích. Mỗi mục trong mảng `groups` cấu hình một tập hợp các model theo một nhóm nhất định, thường là theo khu vực địa lý hoặc cấu hình riêng biệt.

Mặc định: Không xác định

Lưu ý: Xem ví dụ ở trên.

Cấu trúc đối tượng Group

Mỗi mục trong groups là một phần của danh sách các bản ghi, mỗi mục bao gồm các trường sau:

group

Khóa:

KeyTypeDescriptionExample
groupStringĐịnh danh cho một nhóm các model.

Bắt buộc:

Ví dụ:

"group": "my-westus"

apiKey

Khóa:

KeyTypeDescriptionExample
apiKeyStringKhóa API để truy cập Azure OpenAI Service.It's highly recommended to use a custom env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Bắt buộc:

Ví dụ:

apiKey: "${WESTUS_API_KEY}"

instanceName

Khóa:

KeyTypeDescriptionExample
instanceNameStringTên của instance Azure. **Hỗ trợ cả hai định dạng tên miền**: `.openai.azure.com` (cũ) và `.cognitiveservices.azure.com` (mới). Bạn có thể chỉ định tên miền đầy đủ (ví dụ: `my-instance.cognitiveservices.azure.com`) hoặc chỉ tên instance (ví dụ: `my-instance`) để tương thích ngược với định dạng `.openai.azure.com` cũ.It's recommended to use a custom env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Bắt buộc:

Ví dụ:

# Using just the instance name (legacy format applied)
instanceName: "my-westus"
# OR using the full domain (new format)
instanceName: "my-westus.cognitiveservices.azure.com"

version

Khóa:

KeyTypeDescriptionExample
versionStringPhiên bản API.It's recommended to use a custom env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Mặc định: Không xác định

Ví dụ:

version: "2023-12-01-preview"

baseURL

Khóa:

KeyTypeDescriptionExample
baseURLStringURL cơ sở cho Azure OpenAI Service.It's recommended to use a custom env. variable reference for this field, i.e. `${YOUR_VARIABLE}`

Mặc định: Không xác định

Ví dụ:

baseURL: "https://prod.example.com"

additionalHeaders

Khóa:

KeyTypeDescriptionExample
additionalHeadersDictionaryCác header bổ sung cho các yêu cầu API. Tất cả các giá trị header phải là chuỗi.It's recommended to use a custom env. variable reference for the values of field, as shown in the example. `api-key` header value is sent on every request.

Mặc định: Không xác định

Ví dụ:

additionalHeaders:
  X-Custom-Header: ${YOUR_SECRET_CUSTOM_VARIABLE}

serverless

Khóa:

KeyTypeDescriptionExample
serverlessBooleanChỉ định việc sử dụng endpoint suy luận serverless cho các hoàn tất trò chuyện của Azure OpenAI. Khi được đặt thành `true`, chỉ định rằng nhóm được cấu hình để sử dụng các endpoint suy luận serverless dưới dạng mô hình "Models as a Service" của Azure.More info [here](../ai_endpoints/azure.mdx#serverless-inference-endpoints)

Mặc định: Không xác định

Ví dụ:

serverless: true

addParams

Khóa:

KeyTypeDescriptionExample
addParamsObject/DictionaryThêm các tham số bổ sung vào các yêu cầu. Hữu ích để chỉ định các tùy chọn dành riêng cho API.

Mặc định: Không xác định

Ví dụ:

addParams:
  safe_prompt: true

dropParams

Khóa:

KeyTypeDescriptionExample
dropParamsArray/List of StringsLoại bỏ các tham số mặc định khỏi các yêu cầu. Loại trừ các tham số mặc định được chỉ định.Default parameters are the standard request parameters LibreChat sends to the Azure OpenAI API.

Mặc định: Không xác định

Ví dụ:

dropParams: ["stop", "user", "frequency_penalty", "presence_penalty"]

models

Khóa:

KeyTypeDescriptionExample
modelsCấu hình cho các model riêng lẻ trong một nhóm. Thiết lập các cài đặt cho từng model, bao gồm tên triển khai và phiên bản.Model configurations can adopt the group's deployment name and/or version when configured as a boolean (set to `true`) or an object for detailed settings of either of those fields.

Mặc định: Không xác định

Ví dụ:

models:
  gpt-4-vision-preview: 
    deploymentName: "arbitrary-deployment-name"
    version: "2024-02-15-preview"

Hướng dẫn này thế nào?