lmnr 0.2.4__tar.gz → 0.2.5__tar.gz
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.
- {lmnr-0.2.4 → lmnr-0.2.5}/PKG-INFO +3 -3
- {lmnr-0.2.4 → lmnr-0.2.5}/README.md +2 -3
- {lmnr-0.2.4 → lmnr-0.2.5}/pyproject.toml +2 -2
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/sdk/remote_debugger.py +17 -8
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/types.py +6 -2
- {lmnr-0.2.4 → lmnr-0.2.5}/LICENSE +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/__main__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/cli.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/cookiecutter.json +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/parser/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/parser/nodes/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/parser/nodes/types.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/parser/parser.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/parser/utils.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/action.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/engine.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/state.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/task.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/pipelines/{{cookiecutter.pipeline_dir_name}}/__init__.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/pipelines/{{cookiecutter.pipeline_dir_name}}/nodes/functions.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/pipelines/{{cookiecutter.pipeline_dir_name}}/{{cookiecutter.pipeline_dir_name}}.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/types.py +0 -0
- {lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/sdk/endpoint.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lmnr
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.5
|
4
4
|
Summary: Python SDK for Laminar AI
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: lmnr.ai
|
@@ -121,9 +121,8 @@ Example:
|
|
121
121
|
from lmnr import LaminarRemoteDebugger, NodeInput
|
122
122
|
|
123
123
|
# adding **kwargs is safer, in case an LLM produces more arguments than needed
|
124
|
-
def my_tool(arg1: string, arg2: string, **kwargs) -> NodeInput
|
124
|
+
def my_tool(arg1: string, arg2: string, **kwargs) -> NodeInput:
|
125
125
|
return f'{arg1}&{arg2}'
|
126
|
-
}
|
127
126
|
|
128
127
|
debugger = LaminarRemoteDebugger('<YOUR_PROJECT_API_KEY>', [my_tool])
|
129
128
|
session_id = debugger.start() # the session id will also be printed to console
|
@@ -184,3 +183,4 @@ print(f"RESULT:\n{res}")
|
|
184
183
|
## PROJECT_API_KEY
|
185
184
|
|
186
185
|
Read more [here](https://docs.lmnr.ai/api-reference/introduction#authentication) on how to get `PROJECT_API_KEY`.
|
186
|
+
|
@@ -98,9 +98,8 @@ Example:
|
|
98
98
|
from lmnr import LaminarRemoteDebugger, NodeInput
|
99
99
|
|
100
100
|
# adding **kwargs is safer, in case an LLM produces more arguments than needed
|
101
|
-
def my_tool(arg1: string, arg2: string, **kwargs) -> NodeInput
|
101
|
+
def my_tool(arg1: string, arg2: string, **kwargs) -> NodeInput:
|
102
102
|
return f'{arg1}&{arg2}'
|
103
|
-
}
|
104
103
|
|
105
104
|
debugger = LaminarRemoteDebugger('<YOUR_PROJECT_API_KEY>', [my_tool])
|
106
105
|
session_id = debugger.start() # the session id will also be printed to console
|
@@ -160,4 +159,4 @@ print(f"RESULT:\n{res}")
|
|
160
159
|
|
161
160
|
## PROJECT_API_KEY
|
162
161
|
|
163
|
-
Read more [here](https://docs.lmnr.ai/api-reference/introduction#authentication) on how to get `PROJECT_API_KEY`.
|
162
|
+
Read more [here](https://docs.lmnr.ai/api-reference/introduction#authentication) on how to get `PROJECT_API_KEY`.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "lmnr"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.5"
|
4
4
|
description = "Python SDK for Laminar AI"
|
5
5
|
authors = [
|
6
6
|
{ name = "lmnr.ai", email = "founders@lmnr.ai" }
|
@@ -11,7 +11,7 @@ license = "Apache-2.0"
|
|
11
11
|
|
12
12
|
[tool.poetry]
|
13
13
|
name = "lmnr"
|
14
|
-
version = "0.2.
|
14
|
+
version = "0.2.5"
|
15
15
|
description = "Python SDK for Laminar AI"
|
16
16
|
authors = ["lmnr.ai"]
|
17
17
|
readme = "README.md"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import Callable, Optional
|
2
2
|
from websockets.sync.client import connect
|
3
|
-
|
3
|
+
import websockets
|
4
|
+
from lmnr.types import DeregisterDebuggerRequest, NodeInput, RegisterDebuggerRequest, SDKError, ToolCall, ToolCallError
|
4
5
|
import uuid
|
5
6
|
import json
|
6
7
|
from threading import Thread
|
@@ -47,6 +48,9 @@ class RemoteDebugger:
|
|
47
48
|
message = websocket.recv(3)
|
48
49
|
except TimeoutError:
|
49
50
|
continue
|
51
|
+
except websockets.exceptions.ConnectionClosedError:
|
52
|
+
print("Connection closed. Please restart the debugger.")
|
53
|
+
return
|
50
54
|
try:
|
51
55
|
tool_call = ToolCall.model_validate_json(message)
|
52
56
|
except:
|
@@ -56,11 +60,11 @@ class RemoteDebugger:
|
|
56
60
|
if tool.__name__ == tool_call.function.name
|
57
61
|
]
|
58
62
|
if not matching_tools:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
error_message = f'Tool {tool_call.function.name} not found.' +\
|
64
|
+
f' Registered tools: {", ".join([tool.__name__ for tool in self.tools])}'
|
65
|
+
e = ToolCallError(error=error_message)
|
66
|
+
websocket.send(e.model_dump_json())
|
67
|
+
continue
|
64
68
|
tool = matching_tools[0]
|
65
69
|
if tool.__name__ == tool_call.function.name:
|
66
70
|
# default the arguments to an empty dictionary
|
@@ -69,8 +73,13 @@ class RemoteDebugger:
|
|
69
73
|
arguments = json.loads(tool_call.function.arguments)
|
70
74
|
except:
|
71
75
|
pass
|
72
|
-
|
73
|
-
|
76
|
+
try:
|
77
|
+
response = tool(**arguments) # of type NodeInput
|
78
|
+
websocket.send(json.dumps(response))
|
79
|
+
except Exception as e:
|
80
|
+
error_message = f'Error occurred while running tool {tool.__name__}: {e}'
|
81
|
+
e = ToolCallError(error=error_message)
|
82
|
+
websocket.send(e.model_dump_json())
|
74
83
|
websocket.send(DeregisterDebuggerRequest(debuggerSessionId=self.session, deregister=True).model_dump_json())
|
75
84
|
|
76
85
|
def _generate_session_id(self) -> str:
|
@@ -39,8 +39,8 @@ class EndpointRunError(Exception):
|
|
39
39
|
return super().__str__()
|
40
40
|
|
41
41
|
class SDKError(Exception):
|
42
|
-
def __init__(self,
|
43
|
-
super().__init__(
|
42
|
+
def __init__(self, error_message: str):
|
43
|
+
super().__init__(error_message)
|
44
44
|
|
45
45
|
class ToolCallRequest(pydantic.BaseModel):
|
46
46
|
name: str
|
@@ -51,6 +51,10 @@ class ToolCall(pydantic.BaseModel):
|
|
51
51
|
type: Optional[str]
|
52
52
|
function: ToolCallRequest
|
53
53
|
|
54
|
+
ToolCallResponse = NodeInput
|
55
|
+
class ToolCallError(pydantic.BaseModel):
|
56
|
+
error: str
|
57
|
+
|
54
58
|
# TODO: allow snake_case and manually convert to camelCase
|
55
59
|
class RegisterDebuggerRequest(pydantic.BaseModel):
|
56
60
|
debuggerSessionId: str
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/__init__.py
RENAMED
File without changes
|
{lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/action.py
RENAMED
File without changes
|
{lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/engine.py
RENAMED
File without changes
|
{lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/state.py
RENAMED
File without changes
|
{lmnr-0.2.4 → lmnr-0.2.5}/src/lmnr/cli/{{cookiecutter.lmnr_pipelines_dir_name}}/engine/task.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|