Skip to content

feat: remote embeddings #2080

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

Closed
wants to merge 1 commit into from
Closed

feat: remote embeddings #2080

wants to merge 1 commit into from

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

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants