Demo integration with open Router - #5
Conversation
reeshabh90
commented
Aug 7, 2026
- Added or_chat file along with implementation or_classify
- Added 1 test file related to or_classify
- added scope of adding OPENROUTER_API_KEY in build.yml, build.sh, build.ps
…opts to support GCC15
| fail-fast: ${{ (github.event_name == 'schedule' && github.repository == 'docwire/docwire') || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_tests_openai == 'true') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-tests:openai')) }} | ||
| matrix: | ||
| os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-14, macos-15] | ||
| os: [ubuntu-22.04, ubuntu-24.04, ubuntu-26.04, windows-2022, windows-2025, macos-14, macos-15] |
There was a problem hiding this comment.
You are starting from wrong branch probably - these are not proper changes according to the PR description.
| REF c74846a891b3cc3bfa992d588b1295f528d43039 | ||
| SHA512 3e92a67f8d6cb1ba0f80e35b47c9beb9ea14d995bb3e296765475ff31a0b499f3080e359fa87a63273e1e8c5396d4af39d9a47dbe6fa06074bb63a642cf6bfda | ||
| REF 44380e5a44706ab7347f400698c703eb2a196202 | ||
| SHA512 05fc050219a3e41fcf8fe33249f8153d1e4b44360c7aeddba06dedb5c4e2b3145c5ef6c76594732fb67cefc8658a392d11ade441ea48a33892b9e93b7952861f |
There was a problem hiding this comment.
Incorrect changes (different topic)
| #include "translate_to.h" | ||
| #include "type_name.h" | ||
| #include "xml.h" | ||
| #include "or_classify.h" |
There was a problem hiding this comment.
I think that openrouter_*.h would be nicer, "or" is not a good shortcut, it looks like OR operator
|
|
||
| namespace docwire { | ||
|
|
||
| using namespace openrouter; |
There was a problem hiding this comment.
Yes, namespace name should be same as file name prefix (or subdirectory later), so "openrouter_*.h" I think.
| * input. | ||
| */ | ||
| chat(const std::string &system_message, const std::string &api_key, | ||
| const std::string &model = "openrouter/auto", float temperature = 0.7, |
There was a problem hiding this comment.
We need to think should we have some predefined models as a C++ const/constexpr (or enum), It improves verification of the code in build time vs runtime.
| boost::json::object response_obj = response_val.as_object(); | ||
| // OpenRouter returns HTTP 200 with an "error" object (rather than a | ||
| // "choices" array) for some failure modes, e.g. an invalid model slug or an | ||
| // upstream provider error - surface that distinctly instead of failing an |
There was a problem hiding this comment.
Usually it is better to use proper function names like "check_openrouter_error" than to write what the code does in comments. The best code is self-explaining code, comments should be only if there is no possilibity to write understandable code.
| std::filesystem::path("data_processing_definition.doc") | content_type::detector{} | office_formats_parser() | | ||
| plain_text_exporter() | | ||
| ai::local::task("Write a short summary for this text:\n\n") | out_stream; | ||
| ai::local::summarize() | out_stream; |
There was a problem hiding this comment.
What is the reason of this file?
| std::stringstream out_stream; | ||
| docwire::ai::model_inference_config config; | ||
| config.model_path = model_path; | ||
| config.model_path = model_path.string(); |