Skip to content

Demo integration with open Router - #5

Open
reeshabh90 wants to merge 15 commits into
as-ascii:masterfrom
reeshabh90:feature/open-router-integration-poc
Open

Demo integration with open Router #5
reeshabh90 wants to merge 15 commits into
as-ascii:masterfrom
reeshabh90:feature/open-router-integration-poc

Conversation

@reeshabh90

Copy link
Copy Markdown
  • 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

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]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect changes (different topic)

Comment thread src/docwire.h
#include "translate_to.h"
#include "type_name.h"
#include "xml.h"
#include "or_classify.h"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that openrouter_*.h would be nicer, "or" is not a good shortcut, it looks like OR operator

Comment thread src/or_chat.cpp

namespace docwire {

using namespace openrouter;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, namespace name should be same as file name prefix (or subdirectory later), so "openrouter_*.h" I think.

Comment thread src/or_chat.h
* input.
*/
chat(const std::string &system_message, const std::string &api_key,
const std::string &model = "openrouter/auto", float temperature = 0.7,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/or_chat.cpp
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect topic of changes.

Comment thread build_demo.sh

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason of this file?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for?

std::stringstream out_stream;
docwire::ai::model_inference_config config;
config.model_path = model_path;
config.model_path = model_path.string();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this PR.

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.

2 participants