Skip to content

Service request failed , Status: 404 (Not Found) For custom end points #417

Open
@gauravaroa

Description

@gauravaroa

Service

OpenAI

Describe the bug

I have setup custom end point for our in-house model

here getting below error on

ChatMessageContent responseText = chatCompletionResult.Value.Content;

Stack Trace "OpenAI: Service request failed.
Status: 404 (Not Found)

at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
at OpenAI.Chat.ChatClient.CompleteChatAsync(BinaryContent content, RequestOptions options)
at OpenAI.Chat.ChatClient.CompleteChatAsync(IEnumerable`1 messages, ChatCompletionOptions options, CancellationToken cancellationToken)"

but same CompletionEndpoint on trying with CURL working fine

Steps to reproduce

see error

Code snippets

protected virtual OpenAI.OpenAIClient CreateOpenAIClient(string authToken, Uri endpoint)
{
    return new OpenAI.OpenAIClient(
        new ApiKeyCredential(authToken),
        new OpenAIClientOptions
        {
            Endpoint = endpoint,
            NetworkTimeout = TimeSpan.FromSeconds(60),
        });
}

  // Get authentication token
  string authToken = await GetAuthTokenAsync();
  
  // Create OpenAI client with custom endpoint and auth token
  var openAiClient = CreateOpenAIClient(authToken, new Uri(_options.CompletionEndpoint));

  var messages = new List<ChatMessage>
  {
      new SystemChatMessage(systemPrompt),
      new UserChatMessage(userPrompt)
  };

  var chatClient = openAiClient.GetChatClient(model ?? "gpt-4");

var chatCompletionResult = chatClient.CompleteChat(messages, options);
ChatMessageContent responseText = chatCompletionResult.Value.Content;

OS

winOS

.NET version

8

Library version

2.0.0

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions