Repository navigation
Conversation
New openai.rs module sends the direction-aware prompt from prompt.rs to an external chat/completions endpoint (llama.cpp server, vLLM, OpenAI) and returns the reply content verbatim, so improve_formatting applies unchanged. reasoning_content is never read, so thinking models stay clean; a trailing slash in the base URL is normalized away. Motivation: run translations on a machine that only serves the model remotely, instead of loading the GGUF in-process. LibreTranslate#3. async-openai with rustls: no system OpenSSL dependency, matching the hf-hub default TLS stack. Co-authored-by: glm-5.3-flash <glm-5.3-flash@ai.local>
--openai-base-url / --openai-api-key / --openai-model select the remote backend at startup; with no flags the local llama.cpp path is used and behavior is identical to upstream main. Startup fails fast when --openai-base-url is given without a model name: there is no sensible default model for a foreign endpoint. In remote mode no GGUF is loaded at all, and the prompt_lock is not taken - the endpoint handles concurrency itself, while llama.cpp keeps serializing requests. Remote transport failures surface as 503 like the local Busy error, instead of a generic 500. LibreTranslate#3.
Transitive tree of async-openai 0.43 / reqwest 0.13 (LibreTranslate#3). Co-authored-by: glm-5.3-flash <glm-5.3-flash@ai.local>
Author
|
@pierotofy, oh, I see. I forgot to disclose the use of AI. But I use these changes in production, and I reviewed the pull request description — it looked correct and adequate. I can edit the cover message. Or you can count this comment as the AI usage disclosure. Is that enough? If the concern is the size of the diff: the actual code is ~200 lines (async-openai integration + request handling); the rest is Cargo.lock. |
Member
|
I just don't like the way AI wrote it. |
Author
|
ok, what can we do? (Yes, of course, I can do nothing - I made this thing work for me). Where can I find your preference? Your preferred way? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
LTEngine always runs its model in-process. Issue #3 asks for external model support: run the engine without the GGUF on the same machine, or point one engine at a shared inference server (llama.cpp OpenAI-compatible server, vLLM, ollama).
Fix
Opt-in remote mode, selected by three new flags:
--openai-base-url— endpoint root, e.g.http://127.0.0.1:8080/v1--openai-api-key— bearer token (optional)--openai-model— model name sent to the endpoint (required with base-url)Without the flags nothing changes: the local GGUF is loaded and used exactly as before. With them no GGUF is loaded; each
/translaterequest becomes one non-streaming chat completion. The direction-aware prompt fromprompt.rsis reused unchanged, and the reply content is returned verbatim so existing post-processing applies.Closes #3
Testing
cargo check,cargo clippy,cargo testpass (clippy reports 20 warnings, all pre-existing on upstream main; the new code is clean).Live test against a llama.cpp server with a reasoning-enabled model:
--openai-base-urlwithout--openai-model-> startup error, exit 1{"error":"Translation endpoint returned an error: ..."}, server keeps runningNotes for review
prompt_lock(llm.rs): that mutex serializes the in-process llama.cpp backend, while a remote server owns its own concurrency. The in-process path is untouched.reasoning_content(thinking models) is discarded; onlymessage.contentis used.main.rs, no redesign ofllm.rs. Can be restructured to a trait seam if a longer-term external-model API is preferred.async-openai0.43;Cargo.lockupdated accordingly.