Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing name parameter in chat completion message parameters. #118

Closed
anzemur opened this issue Nov 13, 2023 · 14 comments · May be fixed by #119
Closed

Missing name parameter in chat completion message parameters. #118

anzemur opened this issue Nov 13, 2023 · 14 comments · May be fixed by #119

Comments

@anzemur
Copy link

anzemur commented Nov 13, 2023

According to the documentation we should be able to specify the name for each of the base message types/roles (system, assistant, and user) to provide the model with additional information to differentiate between participants of the same role (useful for few-shot prompting).

@rattrayalex
Copy link
Contributor

cc @nknj – thoughts on adding this?

@anzemur
Copy link
Author

anzemur commented Nov 15, 2023

@rattrayalex @nknj any more information on this? I encountered this issue when migrating from version 3.x.x and it seems like these parameters are not deprecated.

@transitive-bullshit
Copy link

It looks like they're deprecating name support, but it would be nice to get an official explanation.

@logankilpatrick
Copy link
Contributor

Can you confirm what the issue is? We document these in the API, are you saying they are not supported here in the SDK?

@anzemur
Copy link
Author

anzemur commented Nov 15, 2023

Yes, they are not supported in the SDK - types ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, and ChatCompletionAssistantMessageParam should all include the name parameter but the usage of these types would result in the following error: Object literal may only specify known properties, and ''name'' does not exist in type.

I am using the node library v4.18.0.

@logankilpatrick
Copy link
Contributor

This should be fixed soon! Hang tight.

@davidmigloz
Copy link
Contributor

#126 includes the fix, so, when merged, #119 can be closed

@anzemur
Copy link
Author

anzemur commented Nov 23, 2023

@logankilpatrick any info on this?

@logankilpatrick
Copy link
Contributor

Fixed!

@anzemur
Copy link
Author

anzemur commented Nov 30, 2023

@logankilpatrick @rattrayalex I updated the npm package version to the current latest version (v4.20.1) and the name parameter is still not available.

@sp88011
Copy link

sp88011 commented Dec 8, 2023

Same (?) issue here. I'm using 4.20.1 and am getting this error when calling openai.chat.completions.create({...payload})

  Types of property 'messages' are incompatible.
        Type '{ role: ChatCompletionRole; content: string; }[]' is not assignable to type 'ChatCompletionMessageParam[]'.
          Type '{ role: OpenAI.Chat.Completions.ChatCompletionRole; content: string; }' is not assignable to type 'ChatCompletionMessageParam'.
            Property 'name' is missing in type '{ role: OpenAI.Chat.Completions.ChatCompletionRole; content: string; }' but required in type 'ChatCompletionFunctionMessageParam'.

My payload looks like this:


      const payload = {
        messages: [
          {
            role: "system" as OpenAI.Chat.ChatCompletionRole,
            content:
              "Use the provided function to solve the user's request and provide a JSON object as a response",
          },
          {
            role: "user" as OpenAI.Chat.ChatCompletionRole,
            content: input.text,
          },
        ],
        tools: tools,
        tool_choice: {
          type: "function",
          function: { name: "my_function_name" },
        },
        response_format: { type: "json_object" },
        model: "gpt-3.5-turbo-1106",
      };
      ```

@rattrayalex
Copy link
Contributor

rattrayalex commented Dec 15, 2023

Sorry about this! A true fix has merged on this repo and should go out in the SDKs shortly.

@shamoons
Copy link

shamoons commented Jan 2, 2024

Still seems to be broken?

@rattrayalex
Copy link
Contributor

@shamoons where do you see name missing that you would have expected it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants