-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Adapt tool_calls and support xinghuo large model #1734
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
base: main
Are you sure you want to change the base?
Conversation
.map(s -> s.toLowerCase()) | ||
.toList() | ||
.contains(finishReason.toLowerCase()); | ||
.contains(finishReason.toLowerCase()) || metadata != null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the metadata but by the presence or absence of usage field.
This won't work, as ChatGenerationMetadata
does not contain usage and it is quite likely always not null. The Usage field in in ChatResponseMetadata.
I can't tell from the docs on this model, but if they are trying to support an OpenAI API, then they should really implement finish_reason, it is common across all AI models we have, 12 of which extend this abstract base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the metadata but by the presence or absence of usage field.
This won't work, as
ChatGenerationMetadata
does not contain usage and it is quite likely always not null. The Usage field in in ChatResponseMetadata.I can't tell from the docs on this model, but if they are trying to support an OpenAI API, then they should really implement finish_reason, it is common across all AI models we have, 12 of which extend this abstract base class.
Thanks for your reply. Yes I found the problem and I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .contains(finishReason.toLowerCase()) || metadata != null);
or event version with Generationusage
is likely not going to be good condition as it can break many of the other implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.contains(finishReason.toLowerCase()) || metadata != null);
or event version with Generationusage
is likely not going to be good condition as it can break many of the other implementations.
Is there any good method? I can only think of this way, or should I add a new model for xinghuo separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @tzolov @markpollack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this model trying to support an OpenAI API?
Not having finish reason seems a design mistake in their API. I want to limit the number of new models as much as possible and it seems like this one is close to openai api compatability. If there is a method that can be made protected in the current OpenAiChatModel or some other seam introduced that would a good way to approach the problem by adding only a small amount of code to support this model. I don't want to have a new model introduced that cut-n-pastes 99% of the current OpenAIChatModel as it will be maintance issue - and we actually already have this problem and don't want to make the problem worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this model trying to support an OpenAI API?
Not having finish reason seems a design mistake in their API. I want to limit the number of new models as much as possible and it seems like this one is close to openai api compatability. If there is a method that can be made protected in the current OpenAiChatModel or some other seam introduced that would a good way to approach the problem by adding only a small amount of code to support this model. I don't want to have a new model introduced that cut-n-pastes 99% of the current OpenAIChatModel as it will be maintance issue - and we actually already have this problem and don't want to make the problem worse.
I agree with your idea. Maybe adding a modelType
parameter in the openai module can solve this problem, and i can rewrite some methods through modelType=xinghuo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this model trying to support an OpenAI API?
Not having finish reason seems a design mistake in their API. I want to limit the number of new models as much as possible and it seems like this one is close to openai api compatability. If there is a method that can be made protected in the current OpenAiChatModel or some other seam introduced that would a good way to approach the problem by adding only a small amount of code to support this model. I don't want to have a new model introduced that cut-n-pastes 99% of the current OpenAIChatModel as it will be maintance issue - and we actually already have this problem and don't want to make the problem worse.I agree with your idea. Maybe adding a
modelType
parameter in the openai module can solve this problem, and i can rewrite some methods through modelType=xinghuo?
In this way, the openai module can be made more extensible, and other models compatible with the openai specification can be removed and adapted using the openai module.
I've tested it and it works for me. |
Thank you for taking time to contribute this pull request!
You might have already read the [contributor guide][1], but as a reminder, please make sure to:
main
branch and squash your commitsCurrently the Xinghuo LLM model doesn't determine whether it's end or not by the
finish_reason
in the metadata but by the presence or absence ofusage
field.