Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Conversation

@vansangpfiev
Copy link
Contributor

@vansangpfiev vansangpfiev commented Mar 7, 2025

Describe Your Changes

This pull request introduces several changes to the RemoteEngine class in the engine/extensions/remote-engine/remote_engine.cc file, primarily focusing on refactoring and adding support for embeddings. The key modifications include the introduction of a new RequestType enum, replacing hardcoded strings with constants, and refactoring functions to handle different request types.

Refactoring and Constants:

  • Added constants kChatCompletions and kEmbeddings to replace hardcoded strings for request types. (engine/extensions/remote-engine/remote_engine.cc)
  • Replaced hardcoded strings with kChatCompletions in various locations to improve code readability and maintainability. (engine/extensions/remote-engine/remote_engine.cc) [1] [2] [3] [4]

Function Refactoring:

  • Refactored MakeChatCompletionRequest to MakeNonStreamRequest to handle both chat completions and embeddings based on the new RequestType enum. (engine/extensions/remote-engine/remote_engine.cc) [1] [2]
  • Updated HandleChatCompletion to use the refactored MakeNonStreamRequest function. (engine/extensions/remote-engine/remote_engine.cc)

Embeddings Support:

  • Added handling for embedding requests and responses, including new templates and URLs for embeddings. (engine/extensions/remote-engine/remote_engine.cc) [1] [2]
  • Introduced new member variables embed_req_template_, embed_res_template_, and embed_url_ to store embedding-specific configurations. (engine/extensions/remote-engine/remote_engine.h)

Error Handling and Logging:

  • Enhanced error handling and logging for missing required fields and template rendering errors in 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

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants