OpenAI Azure의 gpt-4-32k 엔드포인트 지원 여부?

안녕하세요,

OpenAI Azure 엔드포인트에서 문제가 발생하고 있습니다. 다음 URL이 의도대로 작동하지 않는 것 같습니다:

https://***.openai.azure.com/openai/deployments/DEPLOYMENT_NAME/chat/completions?api-version=2023-07-01-preview

여기서 DEPLOYMENT_NAME은 gpt-4-32k로 설정되어 있습니다.

이 문제를 해결하는 데 도움을 주실 수 있을까요? 조언이나 제안을 주시면 감사하겠습니다.

또한 Discourse 플러그인과 관련하여 몇 가지 질문이 있습니다:

  1. Discourse 플러그인 포크하기: 기존 Discourse 플러그인을 포크하는 방법에 대한 자세한 설명이나 가이드를 제공해 주실 수 있을까요?
  2. 포크한 플러그인 테스트: 플러그인을 포크한 후, 제 자체 Discourse 인스턴스에서 이 포크된 버전을 테스트하는 절차는 무엇인가요?
  3. 플러그인 업로드 및 활성화: 테스트 후 이 포크된 플러그인을 제 Discourse 인스턴스에 업로드하고 활성화하는 방법은 무엇인가요?

이러한 질문에 대한 도움은 매우 유용할 것입니다. 시간 내어 지원해 주셔서 감사합니다.

감사합니다,

설정 ai openai gpt4 32k url에 그렇게 설정하셨나요?

네, 확인했습니다. 다만 문제는 lib/summarization/entry_point.rb 파일에서 gpt-4-32k-2023-07-01-preview가 전혀 처리되지 않는 것 같습니다.

module DiscourseAi
  module Summarization
    class EntryPoint
      def inject_into(plugin)
        foldable_models = [
          Models::OpenAi.new("gpt-4", max_tokens: 8192),
          Models::OpenAi.new("gpt-4-32k", max_tokens: 32_768),
          Models::OpenAi.new("gpt-4-1106-preview", max_tokens: 100_000),
          Models::OpenAi.new("gpt-3.5-turbo", max_tokens: 4096),
          Models::OpenAi.new("gpt-3.5-turbo-16k", max_tokens: 16_384),
          Models::Anthropic.new("claude-2", max_tokens: 200_000),
          Models::Anthropic.new("claude-instant-1", max_tokens: 100_000),
          Models::Llama2.new("Llama2-chat-hf", max_tokens: SiteSetting.ai_hugging_face_token_limit),
          Models::Llama2FineTunedOrcaStyle.new(
            "StableBeluga2",
            max_tokens: SiteSetting.ai_hugging_face_token_limit,
          ),
          Models::Gemini.new("gemini-pro", max_tokens: 32_768),
          Models::Mixtral.new("mistralai/Mixtral-8x7B-Instruct-v0.1", max_tokens: 32_000),
        ]

        foldable_models.each do |model|
          plugin.register_summarization_strategy(Strategies::FoldContent.new(model))
        end

        truncable_models = [
          Models::Discourse.new("long-t5-tglobal-base-16384-book-summary", max_tokens: 16_384),
          Models::Discourse.new("bart-large-cnn-samsum", max_tokens: 1024),
          Models::Discourse.new("flan-t5-base-samsum", max_tokens: 512),
        ]

        truncable_models.each do |model|
          plugin.register_summarization_strategy(Strategies::TruncateContent.new(model))
        end
      end
    end
  end
end

로그에서 이 오류를 볼 수 있습니다:

DiscourseAi::Completions::Endpoints::OpenAi: status: 400 - body: {
  "error": {
    "message": "Unrecognized request argument supplied: tools",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}


 
프롬프트와 함께 페이로드 준비: [{:role=>"system", :content=>"You are a helpful Discourse assistant.\nYou _understand_ and **generate** Discourse Markdown.\nYou live in a Discourse Forum Message.\n\nYou live in the forum with the URL: https://<URL>\nThe title of your site: Discourse\nThe description is: \nThe participants in this conversation are: gpt4_bot, Chris\nThe date now is: 2024-01-19 10:10:05 UTC, much has changed since you were trained.\n\nYou were trained on OLD data, lean on search to get up to date information about this forum\nWhen searching try to SIMPLIFY search terms\nDiscourse search joins all terms with AND. Reduce and simplify terms to find more results."}, {:role=>"user", :content=>"comment faire une boucle en dart ?", :name=>"Chris"}], model_params: {}, dialect: #<DiscourseAi::Completions::Dialects::ChatGpt:0x00007f230513e6e0>

아, 알겠습니다. 이는 도구(tool) 지원이 포함된 업데이트된 엔드포인트가 필요하다는 뜻입니다. Azure는 내부적으로 이를 사용하고 있으므로 처리할 수 있습니다.

아니요, Microsoft Azure의 고유한 문제라고 생각하지 않습니다. 순수 JavaScript로 요청을 테스트해 보았으며, “tools” 개념 없이도 아무 문제 없이 작동합니다. 여기서는 플러그인 관련 문제라고 생각합니다(제가 Ruby 개발자가 아님을 명시합니다)만, 사용된 추상화 계층이 상황을 더 복잡하게 만드는 것 같습니다. 확실하지 않아 해당 플러그인을 포크하고 모든 곳에 디버거를 배치했는데, Azure로 전송되는 URL과 헤더는 100% 준수됩니다.

DiscourseAi::Completions::Endpoints::OpenAi: status: 400 - body: { “error”: { “message”: “Unrecognized request argument supplied: tools”, “type”: “invalid_request_error”, “param”: null, “code”: null } }

./lib/completions/endpoints/open_ai.rb (DiscourseAi::Completions::Endpoints::OpenAi)에서 "tools"를 호출하는 유일한 곳은 다음과 같습니다:

    def prepare_payload(prompt, model_params, dialect)
      Rails.logger.warn("Preparing payload with prompt: #{prompt}, model_params: #{model_params}, dialect: #{dialect}")
      default_options
        .merge(model_params)
        .merge(messages: prompt)
        .tap do |payload|
          payload[:stream] = true if @streaming_mode
          payload[:tools] = dialect.tools if dialect.tools.present?
        end
    end

이는 ./lib/completions/dialects/chat_gpt.rb (payload[:tools] = dialect.tools if dialect.tools.present?)로 이어지는 것으로 보입니다.

PEYRUSSE Christian의 메시지에서는 "dialect"가 "dialect: #DiscourseAi::Completions::Dialects::ChatGpt:0x00007f230513e6e0"임을 알 수 있습니다.

도움이 될 수 있다면…

감사합니다.

최신 엔드포인트를 사용하는 한 그런 문제가 아닙니다.

이 사이트에서는 Azure 엔드포인트를 사용 중이며, 파라미터로 api-version=2023-12-01-preview를 지정하고 있습니다. 해당 API 버전을 사용하는 엔드포인트로 시도해 보실 수 있을까요?

확인 후 다음 주에 꼭 알려드리겠습니다. 감사합니다.

안녕하세요,

오늘 아침에 Discourse AI 플러그인을 업데이트했는데, 이제 정상적으로 작동합니다. 정말 감사합니다. 도움을 주셔서 감사합니다.