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.
Describe Your Changes
This pull request introduces several changes to the
RemoteEngine
class in theengine/extensions/remote-engine/remote_engine.cc
file, primarily focusing on refactoring and adding support for embeddings. The key modifications include the introduction of a newRequestType
enum, replacing hardcoded strings with constants, and refactoring functions to handle different request types.Refactoring and Constants:
kChatCompletions
andkEmbeddings
to replace hardcoded strings for request types. (engine/extensions/remote-engine/remote_engine.cc
)kChatCompletions
in various locations to improve code readability and maintainability. (engine/extensions/remote-engine/remote_engine.cc
) [1] [2] [3] [4]Function Refactoring:
MakeChatCompletionRequest
toMakeNonStreamRequest
to handle both chat completions and embeddings based on the newRequestType
enum. (engine/extensions/remote-engine/remote_engine.cc
) [1] [2]HandleChatCompletion
to use the refactoredMakeNonStreamRequest
function. (engine/extensions/remote-engine/remote_engine.cc
)Embeddings Support:
engine/extensions/remote-engine/remote_engine.cc
) [1] [2]embed_req_template_
,embed_res_template_
, andembed_url_
to store embedding-specific configurations. (engine/extensions/remote-engine/remote_engine.h
)Error Handling and Logging:
HandleEmbedding
. (engine/extensions/remote-engine/remote_engine.cc
)These changes improve the code structure, readability, and extend the functionality of the
RemoteEngine
class to support embeddings alongside chat completions.Fixes Issues
Self Checklist