DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
model_chain_element.h
1 /*********************************************************************************************************************************************/
2 /* DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. */
3 /* Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, */
4 /* document analysis. Offline processing possible for security and confidentiality */
5 /* */
6 /* Copyright (c) SILVERCODERS Ltd, http://silvercoders.com */
7 /* Project homepage: https://github.com/docwire/docwire */
8 /* */
9 /* SPDX-License-Identifier: GPL-2.0-only OR LicenseRef-DocWire-Commercial */
10 /*********************************************************************************************************************************************/
11 
12 #ifndef DOCWIRE_LOCAL_AI_MODEL_CHAIN_ELEMENT_H
13 #define DOCWIRE_LOCAL_AI_MODEL_CHAIN_ELEMENT_H
14 
15 #include "chain_element.h"
16 #include "local_ai_export.h"
17 #include "model_runner.h"
18 
19 namespace docwire::local_ai
20 {
21 
30 class DOCWIRE_LOCAL_AI_EXPORT model_chain_element : public ChainElement
31 {
32 public:
39  model_chain_element(const std::string& prompt, std::shared_ptr<model_runner> model_runner)
40  : m_prompt{prompt}, m_model_runner{model_runner}
41  {}
42 
51  model_chain_element(const std::string& prompt);
52 
64  continuation operator()(message_ptr msg, const message_callbacks& emit_message) override;
65 
74  bool is_leaf() const override
75  {
76  return false;
77  }
78 
79 private:
80  std::string m_prompt;
81  std::shared_ptr<model_runner> m_model_runner;
82 };
83 
84 } // namespace docwire::local_ai
85 
86 #endif // DOCWIRE_AI_MODEL_CHAIN_ELEMENT_H
A model chain element that processes input text using a model runner.
model_chain_element(const std::string &prompt, std::shared_ptr< model_runner > model_runner)
Construct a model chain element.
bool is_leaf() const override
Check if the model chain element is a leaf.
continuation operator()(message_ptr msg, const message_callbacks &emit_message) override
Process the input.
model_chain_element(const std::string &prompt)
Construct a model chain element with a default model runner.
Class representing the AI model loaded to memory.
Definition: model_runner.h:32