fix(input): handle correctly case where we pass by string list as inputs #5521
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request refactors type handling and improves type safety in the
mergeOpenAIRequestAndBackendConfig
function withincore/http/middleware/request.go
. The changes focus on replacinginterface{}
with the more modernany
type and enhancing the processing of nested data structures.Type handling improvements:
interface{}
withany
for better readability and alignment with Go's modern conventions. ([core/http/middleware/request.goL386-R405](https://github.com/mudler/LocalAI/pull/5521/files#diff-953fd8ea90e198b803c88d4a658f3844ff95756ca4fa73658d8dda4e4827faf0L386-R405)
)Nested data structure processing:
int
,float64
, andstring
types within the inner loop. This ensures that all valid input types are processed correctly. ([core/http/middleware/request.goL386-R405](https://github.com/mudler/LocalAI/pull/5521/files#diff-953fd8ea90e198b803c88d4a658f3844ff95756ca4fa73658d8dda4e4827faf0L386-R405)
)string
values toconfig.InputStrings
in addition to handling numeric types forconfig.InputToken
. ([core/http/middleware/request.goL386-R405](https://github.com/mudler/LocalAI/pull/5521/files#diff-953fd8ea90e198b803c88d4a658f3844ff95756ca4fa73658d8dda4e4827faf0L386-R405)
)Notes for Reviewers
Signed commits