legion-llm 0.5.23 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/legion/llm/daemon_client.rb +6 -3
- data/lib/legion/llm/routes.rb +13 -7
- data/lib/legion/llm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7faa875219df27f00724444b192db231e6ef9f0b9a56da041791fbec1a17abb0
|
|
4
|
+
data.tar.gz: 271946a65933ed5366a9240490f4ba2df08f9a5c70200ab3b2605d413f6da611
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b75a996f84fa52a56e2dd145ae411007e7b0e82ebbf4c3ebf472d3368c8fb9647c311de67eb3500861c2758ba2c62ae7d90c7f8540c2080625ee99ba40d21c2
|
|
7
|
+
data.tar.gz: d390c9821b76cca8889c46a5f1999408de60dadb5d0c6db05c3fa7b0e68faa152bd557b9e19e38897b5ff52af8a05be26f74f0dc32a10ea09a282247a62f0c60
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.5.24] - 2026-03-31
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `DaemonClient.inference` accepts optional `caller:` and `conversation_id:` kwargs, forwarded in POST body
|
|
9
|
+
- `/api/llm/inference` route accepts `caller` and `conversation_id` from POST body, forwards to `Legion::LLM.chat`
|
|
10
|
+
|
|
5
11
|
## [0.5.23] - 2026-03-31
|
|
6
12
|
|
|
7
13
|
### Added
|
|
@@ -105,10 +105,13 @@ module Legion
|
|
|
105
105
|
# POSTs a conversation-level inference request to the daemon REST API.
|
|
106
106
|
# Accepts a full messages array and optional tool schemas.
|
|
107
107
|
# Returns a status hash with structured inference fields on success.
|
|
108
|
-
def inference(messages:, tools: [], model: nil, provider: nil,
|
|
108
|
+
def inference(messages:, tools: [], model: nil, provider: nil, caller: nil, conversation_id: nil,
|
|
109
|
+
timeout: 120)
|
|
109
110
|
body = { messages: messages, tools: tools }
|
|
110
|
-
body[:model]
|
|
111
|
-
body[:provider]
|
|
111
|
+
body[:model] = model if model
|
|
112
|
+
body[:provider] = provider if provider
|
|
113
|
+
body[:caller] = caller if caller
|
|
114
|
+
body[:conversation_id] = conversation_id if conversation_id
|
|
112
115
|
|
|
113
116
|
response = http_post('/api/llm/inference', body, timeout: timeout)
|
|
114
117
|
interpret_inference_response(response)
|
data/lib/legion/llm/routes.rb
CHANGED
|
@@ -289,10 +289,12 @@ module Legion
|
|
|
289
289
|
body = parse_request_body
|
|
290
290
|
validate_required!(body, :messages)
|
|
291
291
|
|
|
292
|
-
messages
|
|
293
|
-
raw_tools
|
|
294
|
-
model
|
|
295
|
-
provider
|
|
292
|
+
messages = body[:messages]
|
|
293
|
+
raw_tools = body[:tools]
|
|
294
|
+
model = body[:model]
|
|
295
|
+
provider = body[:provider]
|
|
296
|
+
caller_context = body[:caller]
|
|
297
|
+
conversation_id = body[:conversation_id]
|
|
296
298
|
|
|
297
299
|
unless messages.is_a?(Array)
|
|
298
300
|
halt 400, { 'Content-Type' => 'application/json' },
|
|
@@ -331,13 +333,17 @@ module Legion
|
|
|
331
333
|
{ role: ms[:role].to_s, content: ms[:content].to_s }
|
|
332
334
|
end
|
|
333
335
|
|
|
334
|
-
|
|
336
|
+
effective_caller = caller_context || { source: 'api', path: request.path }
|
|
337
|
+
chat_opts = {
|
|
335
338
|
messages: normalized_messages,
|
|
336
339
|
model: model,
|
|
337
340
|
provider: provider,
|
|
338
341
|
tools: tool_declarations,
|
|
339
|
-
caller:
|
|
340
|
-
|
|
342
|
+
caller: effective_caller
|
|
343
|
+
}
|
|
344
|
+
chat_opts[:conversation_id] = conversation_id if conversation_id
|
|
345
|
+
|
|
346
|
+
result = Legion::LLM.chat(**chat_opts)
|
|
341
347
|
|
|
342
348
|
if result.is_a?(Legion::LLM::Pipeline::Response)
|
|
343
349
|
raw_msg = result.message
|
data/lib/legion/llm/version.rb
CHANGED