22#ifdef NEOGRAPH_HAVE_GRPC
28#include <unordered_map>
31#if __has_include(<grpcpp/impl/service_type.h>)
32#include <grpcpp/impl/service_type.h>
34#include <grpcpp/impl/codegen/service_type.h>
38#include <neograph/grpc/serve_options.h>
41#include <asio/awaitable.hpp>
43namespace neograph::grpc {
53using ToolFn = std::function<std::string(
const std::string&)>;
57NEOGRAPH_API std::unique_ptr<::grpc::Service> make_tool_service(
58 std::unordered_map<std::string, ToolFn> tools);
65NEOGRAPH_API
void run_tool_server(
66 const std::string& address,
67 std::unordered_map<std::string, ToolFn> tools);
70NEOGRAPH_API
void run_tool_server(
71 const std::string& address,
72 std::unordered_map<std::string, ToolFn> tools,
73 const ServeOptions& options);
94 GrpcRemoteTool(
const std::string& target,
96 std::string description,
97 neograph::json parameters);
98 ~GrpcRemoteTool()
override;
100 ChatTool get_definition()
const override;
101 std::string execute(
const neograph::json& arguments)
override;
105 asio::awaitable<std::string> execute_async(
107 std::string get_name()
const override;
112 void set_call_timeout(std::chrono::milliseconds timeout);
116 std::unique_ptr<Impl> impl_;
NEOGRAPH_API export/import macro for shared-library builds.
Optional async Tool extension that receives per-invocation context.
Per-invocation context for a cooperative asynchronous tool.