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

Fix model identification when creating conversations #820

Merged
merged 2 commits into from Mar 15, 2024

Conversation

zacps
Copy link
Contributor

@zacps zacps commented Feb 13, 2024

PR #181 introduced a model ID field so that models could be switched out without breaking existing conversations. However, the new conversation endpoint incorrectly uses the model name instead of ID, so without this fix it was not possible to have a model with a different ID and name.

@zacps zacps force-pushed the model-id-conversation-patch branch from e93c65d to 8e0a10c Compare February 13, 2024 21:33
@nsarrazin
Copy link
Collaborator

Hi, thanks for the contribution! I'm not sure I fully understand what the code is supposed to do here. Could you give an example of an issue you were having that this solves?

I could imagine scenarios where (m.id ?? m.name) === values.model); or m.id === values.model || m.name === values.model would make sense but wouldn't m.id || m.name === values.model just return the first model with non-null ID?

@zacps zacps force-pushed the model-id-conversation-patch branch from 8e0a10c to 24a095f Compare February 14, 2024 20:49
@zacps
Copy link
Contributor Author

zacps commented Feb 14, 2024

Yes! Thanks for catching that, I made mistake with precedence; fixed :).

I think (m.id ?? m.name) === values.model); and (m.id || m.name) === values.model); are functionally equivalent here but happy to use one over the other if you prefer.

Currently if you have a model configured with a different id and name, for example something like:

   {
      "id": "gpt-4-1106-preview",
      "name": "gpt-4",
      "displayName": "GPT 4 Turbo",
      "endpoints" : [{
         "type": "openai" ,
      }]
   },

You won't be able to create any conversations because the client sends the model id, gpt-4-1106-preview, and the server only searches the model names ["gpt-4"].

@zacps zacps force-pushed the model-id-conversation-patch branch 4 times, most recently from f76b4f9 to 38ff05c Compare February 20, 2024 20:20
@nsarrazin nsarrazin added bug Something isn't working back This issue is related to the Svelte backend or the DB labels Feb 22, 2024
@zacps zacps force-pushed the model-id-conversation-patch branch 2 times, most recently from 6bf4d2e to 8cbab70 Compare March 1, 2024 02:28
@zacps
Copy link
Contributor Author

zacps commented Mar 1, 2024

@nsarrazin do you think you'll have a chance to review this soon? This is the last PR keeping us on a fork.

@zacps zacps force-pushed the model-id-conversation-patch branch 2 times, most recently from b8d911e to 619e238 Compare March 11, 2024 01:54
PR huggingface#181 introduced a model ID field so that models could be switched out
without breaking existing conversations. However, the new conversation
endpoint incorrectly uses the model name instead of ID, so without this
fix it was not possible to have a model with a different ID and name.
@zacps zacps force-pushed the model-id-conversation-patch branch from 619e238 to 7692682 Compare March 11, 2024 22:46
@nsarrazin
Copy link
Collaborator

Finally got around to reviewing this sorry! Will merge it now, thanks for the contrib @zacps 🚀

@nsarrazin nsarrazin merged commit 7849c30 into huggingface:main Mar 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back This issue is related to the Svelte backend or the DB bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants