llmling 2.0.0__tar.gz → 2.0.2__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.
- {llmling-2.0.0 → llmling-2.0.2}/PKG-INFO +5 -28
- {llmling-2.0.0 → llmling-2.0.2}/pyproject.toml +6 -7
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/utils.py +1 -2
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/manager.py +5 -4
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/models.py +6 -2
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/runtime.py +3 -1
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/utils.py +2 -3
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/baseregistry.py +0 -1
- llmling-2.0.2/src/llmling/log.py +17 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/prompts/registry.py +1 -4
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/base.py +3 -5
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/base.py +10 -10
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/importing.py +1 -2
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/openapi.py +0 -2
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/registry.py +2 -2
- {llmling-2.0.0 → llmling-2.0.2}/LICENSE +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/README.md +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/__main__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/config.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/constants.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/prompts.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/resources.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/cli/tools.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/completions/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/completions/protocols.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/completions/types.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/base.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/llm_tools.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config/store.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config_resources/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config_resources/basic.yml +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config_resources/test.yml +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config_resources/watch_examples.yml +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/config_resources/web_research.yml +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/chain.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/descriptors.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/exceptions.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/log.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/typedefs.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/core/utils.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/processors/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/processors/base.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/processors/jinjaprocessor.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/processors/registry.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/prompts/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/prompts/models.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/prompts/utils.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/py.typed +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/callable.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/cli.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/path.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/registry.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/repository.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/source.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/loaders/text.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/models.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/registry.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/watching/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/watching/utils.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/resources/watching/watcher.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/testing/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/testing/processors.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/testing/tools.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/code.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/entry_points.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/exceptions.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/tools/toolsets.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/utils/__init__.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/utils/calling.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/utils/importing.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/utils/paths.py +0 -0
- {llmling-2.0.0 → llmling-2.0.2}/src/llmling/utils/watcher.py +0 -0
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: llmling
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A backend for pydantic-AI agents and MCP servers.
|
|
5
5
|
Keywords:
|
|
6
6
|
Author: Philipp Temminghoff
|
|
7
7
|
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
-
License: MIT
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2024, Philipp Temminghoff
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
30
10
|
Classifier: Development Status :: 4 - Beta
|
|
31
11
|
Classifier: Framework :: Pydantic
|
|
32
12
|
Classifier: Framework :: Pydantic :: 2
|
|
@@ -50,12 +30,9 @@ Requires-Dist: pathspec
|
|
|
50
30
|
Requires-Dist: platformdirs>=4.3.6
|
|
51
31
|
Requires-Dist: promptantic>=0.4.3
|
|
52
32
|
Requires-Dist: psygnal>=0.11.1
|
|
53
|
-
Requires-Dist: py2openai
|
|
54
33
|
Requires-Dist: pydantic
|
|
55
|
-
Requires-Dist: schemez
|
|
56
|
-
Requires-Dist: schemez>=0.2.2
|
|
34
|
+
Requires-Dist: schemez>=1.2.0
|
|
57
35
|
Requires-Dist: typer
|
|
58
|
-
Requires-Dist: typing-extensions>=4.12.2
|
|
59
36
|
Requires-Dist: universal-pathlib>=0.2.5
|
|
60
37
|
Requires-Dist: upathtools[httpx]
|
|
61
38
|
Requires-Dist: yamling>=1.5.0
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "llmling"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.2"
|
|
4
4
|
description = "A backend for pydantic-AI agents and MCP servers."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
|
-
license =
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
8
9
|
authors = [
|
|
9
10
|
{ name = "Philipp Temminghoff", email = "philipptemminghoff@googlemail.com" },
|
|
10
11
|
]
|
|
@@ -36,12 +37,9 @@ dependencies = [
|
|
|
36
37
|
"platformdirs>=4.3.6",
|
|
37
38
|
"promptantic>=0.4.3",
|
|
38
39
|
"psygnal>=0.11.1",
|
|
39
|
-
"py2openai",
|
|
40
40
|
"pydantic",
|
|
41
|
-
"schemez",
|
|
42
|
-
"schemez>=0.2.2",
|
|
41
|
+
"schemez>=1.2.0",
|
|
43
42
|
"typer",
|
|
44
|
-
"typing-extensions>=4.12.2",
|
|
45
43
|
"universal-pathlib>=0.2.5",
|
|
46
44
|
"upathtools[httpx]",
|
|
47
45
|
"yamling>=1.5.0",
|
|
@@ -311,13 +309,14 @@ combine-as-imports = true
|
|
|
311
309
|
[tool.ruff.lint.per-file-ignores]
|
|
312
310
|
"__init__.py" = ["E402", "I001"]
|
|
313
311
|
"scripts/*" = ["INP001"]
|
|
312
|
+
"*tests/*" = ["D100"]
|
|
314
313
|
|
|
315
314
|
[tool.ruff.format]
|
|
316
|
-
# Enable preview style formatting.
|
|
317
315
|
preview = true
|
|
318
316
|
|
|
319
317
|
[tool.ty.environment]
|
|
320
318
|
python-version = "3.13"
|
|
319
|
+
python-platform = "all"
|
|
321
320
|
|
|
322
321
|
[tool.uv]
|
|
323
322
|
default-groups = ["dev", "lint", "docs"]
|
|
@@ -3,9 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import json
|
|
4
4
|
from typing import TYPE_CHECKING, Any, Literal
|
|
5
5
|
|
|
6
|
-
from py2openai import OpenAIFunctionTool
|
|
7
6
|
from pydantic import BaseModel
|
|
8
|
-
from schemez import Schema
|
|
7
|
+
from schemez import OpenAIFunctionTool, Schema
|
|
9
8
|
|
|
10
9
|
from llmling.config.store import config_store
|
|
11
10
|
|
|
@@ -12,7 +12,8 @@ from llmling.core.log import get_logger, setup_logging
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
|
-
import
|
|
15
|
+
from upath.types import JoinablePathLike
|
|
16
|
+
|
|
16
17
|
|
|
17
18
|
logger = get_logger(__name__)
|
|
18
19
|
REQ_PATTERN = re.compile(
|
|
@@ -40,7 +41,7 @@ class ConfigManager:
|
|
|
40
41
|
|
|
41
42
|
def save(
|
|
42
43
|
self,
|
|
43
|
-
path:
|
|
44
|
+
path: JoinablePathLike,
|
|
44
45
|
*,
|
|
45
46
|
validate: bool = True,
|
|
46
47
|
) -> None:
|
|
@@ -85,7 +86,7 @@ class ConfigManager:
|
|
|
85
86
|
@classmethod
|
|
86
87
|
def load(
|
|
87
88
|
cls,
|
|
88
|
-
path:
|
|
89
|
+
path: JoinablePathLike,
|
|
89
90
|
*,
|
|
90
91
|
validate: bool = True,
|
|
91
92
|
strict: bool = False,
|
|
@@ -112,7 +113,7 @@ class ConfigManager:
|
|
|
112
113
|
|
|
113
114
|
def add_config(
|
|
114
115
|
self,
|
|
115
|
-
path:
|
|
116
|
+
path: JoinablePathLike,
|
|
116
117
|
*,
|
|
117
118
|
validate: bool = True,
|
|
118
119
|
strict: bool = False,
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from collections.abc import Sequence as TypingSequence
|
|
6
6
|
import inspect
|
|
7
7
|
import os
|
|
8
|
-
from typing import Annotated, Any, Literal, Self
|
|
8
|
+
from typing import TYPE_CHECKING, Annotated, Any, Literal, Self
|
|
9
9
|
import warnings
|
|
10
10
|
|
|
11
11
|
from pydantic import (
|
|
@@ -28,6 +28,10 @@ from llmling.utils.importing import import_callable, import_class
|
|
|
28
28
|
from llmling.utils.paths import guess_mime_type
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
if TYPE_CHECKING:
|
|
32
|
+
from upath.types import JoinablePathLike
|
|
33
|
+
|
|
34
|
+
|
|
31
35
|
ResourceType = Literal["path", "text", "cli", "source", "callable"]
|
|
32
36
|
LogLevel = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
|
33
37
|
|
|
@@ -641,7 +645,7 @@ class Config(ConfigModel):
|
|
|
641
645
|
raise ValueError(msg)
|
|
642
646
|
|
|
643
647
|
@classmethod
|
|
644
|
-
def from_file(cls, path:
|
|
648
|
+
def from_file(cls, path: JoinablePathLike) -> Self:
|
|
645
649
|
"""Load configuration from YAML file.
|
|
646
650
|
|
|
647
651
|
This function only handles the basic loading and model validation.
|
|
@@ -35,6 +35,8 @@ if TYPE_CHECKING:
|
|
|
35
35
|
from collections.abc import AsyncIterator, Callable, Iterator, Sequence
|
|
36
36
|
import types
|
|
37
37
|
|
|
38
|
+
from upath.types import JoinablePathLike
|
|
39
|
+
|
|
38
40
|
from llmling.config.models import BaseResource, Config
|
|
39
41
|
from llmling.processors.base import ProcessorResult
|
|
40
42
|
from llmling.prompts.models import BasePrompt
|
|
@@ -304,7 +306,7 @@ class RuntimeConfig:
|
|
|
304
306
|
yield runtime
|
|
305
307
|
|
|
306
308
|
@classmethod
|
|
307
|
-
def from_file(cls, path:
|
|
309
|
+
def from_file(cls, path: JoinablePathLike) -> Self:
|
|
308
310
|
"""Convenience function to directly create runtime config from a file.
|
|
309
311
|
|
|
310
312
|
Args:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import TYPE_CHECKING
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel
|
|
9
9
|
|
|
@@ -26,7 +26,6 @@ if TYPE_CHECKING:
|
|
|
26
26
|
from llmling.tools.toolsets import ToolSet
|
|
27
27
|
|
|
28
28
|
logger = get_logger(__name__)
|
|
29
|
-
T = TypeVar("T", bound=BaseModel)
|
|
30
29
|
|
|
31
30
|
|
|
32
31
|
def toolset_config_to_toolset(config) -> ToolSet:
|
|
@@ -85,7 +84,7 @@ def prepare_runtime(
|
|
|
85
84
|
return runtime_cls.from_config(config)
|
|
86
85
|
|
|
87
86
|
|
|
88
|
-
def merge_models(base: T, overlay: T) -> T:
|
|
87
|
+
def merge_models[T: BaseModel](base: T, overlay: T) -> T:
|
|
89
88
|
"""Deep merge two Pydantic models."""
|
|
90
89
|
if not isinstance(overlay, type(base)):
|
|
91
90
|
msg = f"Cannot merge different types: {type(base)} and {type(overlay)}"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Logging configuration for llmling."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_logger(name: str) -> logging.Logger:
|
|
9
|
+
"""Get a logger for the given name.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
name: The name of the logger, will be prefixed with 'llmling_agent.'
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
A logger instance
|
|
16
|
+
"""
|
|
17
|
+
return logging.getLogger(f"llmling.{name}")
|
|
@@ -9,10 +9,7 @@ from llmling.core import exceptions
|
|
|
9
9
|
from llmling.core.baseregistry import BaseRegistry
|
|
10
10
|
from llmling.core.log import get_logger
|
|
11
11
|
from llmling.prompts.models import BasePrompt, DynamicPrompt
|
|
12
|
-
from llmling.prompts.utils import
|
|
13
|
-
get_completion_for_arg,
|
|
14
|
-
to_prompt,
|
|
15
|
-
)
|
|
12
|
+
from llmling.prompts.utils import get_completion_for_arg, to_prompt
|
|
16
13
|
|
|
17
14
|
|
|
18
15
|
logger = get_logger(__name__)
|
|
@@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
from datetime import datetime
|
|
8
8
|
import os
|
|
9
9
|
import re
|
|
10
|
-
from typing import TYPE_CHECKING, Any, ClassVar,
|
|
10
|
+
from typing import TYPE_CHECKING, Any, ClassVar, cast, overload
|
|
11
11
|
|
|
12
12
|
from llmling.completions.protocols import CompletionProvider
|
|
13
13
|
from llmling.config.models import BaseResource
|
|
@@ -28,8 +28,6 @@ if TYPE_CHECKING:
|
|
|
28
28
|
|
|
29
29
|
logger = get_logger(__name__)
|
|
30
30
|
|
|
31
|
-
TResource = TypeVar("TResource", bound=BaseResource)
|
|
32
|
-
|
|
33
31
|
|
|
34
32
|
def create_loaded_resource(
|
|
35
33
|
*,
|
|
@@ -79,7 +77,7 @@ def create_loaded_resource(
|
|
|
79
77
|
|
|
80
78
|
|
|
81
79
|
@dataclass
|
|
82
|
-
class LoaderContext[TResource]:
|
|
80
|
+
class LoaderContext[TResource: BaseResource]:
|
|
83
81
|
"""Context for resource loading.
|
|
84
82
|
|
|
85
83
|
Provides all information needed to load and identify a resource.
|
|
@@ -96,7 +94,7 @@ class LoaderContext[TResource]:
|
|
|
96
94
|
return f"{cls_name}(name={self.name!r}, type={resource.type})"
|
|
97
95
|
|
|
98
96
|
|
|
99
|
-
class ResourceLoader[TResource](ABC, CompletionProvider):
|
|
97
|
+
class ResourceLoader[TResource: BaseResource](ABC, CompletionProvider):
|
|
100
98
|
"""Base class for resource loaders."""
|
|
101
99
|
|
|
102
100
|
context_class: type[TResource]
|
|
@@ -7,7 +7,7 @@ from dataclasses import dataclass
|
|
|
7
7
|
import inspect
|
|
8
8
|
from typing import Any, ClassVar, Self
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import schemez
|
|
11
11
|
|
|
12
12
|
from llmling.config.models import ToolHints # noqa: TC001
|
|
13
13
|
from llmling.core.descriptors import classproperty
|
|
@@ -20,7 +20,7 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
20
20
|
name: str
|
|
21
21
|
description: str = ""
|
|
22
22
|
import_path: str | None = None
|
|
23
|
-
schema_override:
|
|
23
|
+
schema_override: schemez.OpenAIFunctionDefinition | None = None
|
|
24
24
|
hints: ToolHints | None = None
|
|
25
25
|
|
|
26
26
|
@classmethod
|
|
@@ -30,7 +30,7 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
30
30
|
*,
|
|
31
31
|
name_override: str | None = None,
|
|
32
32
|
description_override: str | None = None,
|
|
33
|
-
schema_override:
|
|
33
|
+
schema_override: schemez.OpenAIFunctionDefinition | None = None,
|
|
34
34
|
hints: ToolHints | None = None,
|
|
35
35
|
) -> Self:
|
|
36
36
|
"""Create a tool from a callable or import path."""
|
|
@@ -67,7 +67,7 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
67
67
|
*,
|
|
68
68
|
name_override: str | None = None,
|
|
69
69
|
description_override: str | None = None,
|
|
70
|
-
schema_override:
|
|
70
|
+
schema_override: schemez.OpenAIFunctionDefinition | None = None,
|
|
71
71
|
) -> Self:
|
|
72
72
|
"""Allows importing crewai / langchain tools."""
|
|
73
73
|
try:
|
|
@@ -94,7 +94,7 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
94
94
|
*,
|
|
95
95
|
name_override: str | None = None,
|
|
96
96
|
description_override: str | None = None,
|
|
97
|
-
schema_override:
|
|
97
|
+
schema_override: schemez.OpenAIFunctionDefinition | None = None,
|
|
98
98
|
) -> Self:
|
|
99
99
|
"""Create a tool from a LangChain tool."""
|
|
100
100
|
try:
|
|
@@ -121,7 +121,7 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
121
121
|
*,
|
|
122
122
|
name_override: str | None = None,
|
|
123
123
|
description_override: str | None = None,
|
|
124
|
-
schema_override:
|
|
124
|
+
schema_override: schemez.OpenAIFunctionDefinition | None = None,
|
|
125
125
|
) -> Self:
|
|
126
126
|
"""Create a tool from a AutoGen tool."""
|
|
127
127
|
try:
|
|
@@ -164,9 +164,9 @@ class LLMCallableTool[**P, TReturnType]:
|
|
|
164
164
|
return await self.callable(*args, **kwargs)
|
|
165
165
|
return self.callable(*args, **kwargs)
|
|
166
166
|
|
|
167
|
-
def get_schema(self) ->
|
|
167
|
+
def get_schema(self) -> schemez.OpenAIFunctionTool:
|
|
168
168
|
"""Get OpenAI function schema."""
|
|
169
|
-
schema =
|
|
169
|
+
schema = schemez.create_schema(self.callable).model_dump_openai()
|
|
170
170
|
schema["function"]["name"] = self.name
|
|
171
171
|
schema["function"]["description"] = self.description
|
|
172
172
|
if self.schema_override:
|
|
@@ -186,9 +186,9 @@ class BaseTool(LLMCallableTool):
|
|
|
186
186
|
"""Get the import path of the tool class."""
|
|
187
187
|
return f"{cls.__module__}.{cls.__qualname__}" # type: ignore
|
|
188
188
|
|
|
189
|
-
def get_schema(self) ->
|
|
189
|
+
def get_schema(self) -> schemez.OpenAIFunctionTool:
|
|
190
190
|
"""Get OpenAI function schema."""
|
|
191
|
-
schema =
|
|
191
|
+
schema = schemez.create_schema(self.execute).model_dump_openai()
|
|
192
192
|
schema["function"]["name"] = self.name
|
|
193
193
|
schema["function"]["description"] = self.description
|
|
194
194
|
return schema
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
from llmling.core.log import get_logger
|
|
8
8
|
from llmling.tools.toolsets import ToolSet
|
|
@@ -10,7 +10,6 @@ from llmling.utils import importing
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
logger = get_logger(__name__)
|
|
13
|
-
T = TypeVar("T", bound=ToolSet)
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
def import_toolset(import_path: str, **kwargs: Any) -> ToolSet:
|
|
@@ -416,9 +416,7 @@ if __name__ == "__main__":
|
|
|
416
416
|
url = "https://bird.ecb.europa.eu/documentation/api/v2/bird/bird-API-V2-documentation-Swagger-OpenAPI.yml"
|
|
417
417
|
oapi = OpenAPITools(url)
|
|
418
418
|
tools = oapi.get_tools()
|
|
419
|
-
# print([t.__name__ for t in tools])
|
|
420
419
|
t = tools[0]
|
|
421
|
-
|
|
422
420
|
result = await t(codes="ANCRDT_INSTRMNT_C")
|
|
423
421
|
print(result)
|
|
424
422
|
|
|
@@ -15,7 +15,7 @@ from llmling.utils import importing
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
16
|
from types import ModuleType
|
|
17
17
|
|
|
18
|
-
import
|
|
18
|
+
import schemez
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
logger = get_logger(__name__)
|
|
@@ -123,7 +123,7 @@ class ToolRegistry(BaseRegistry[str, LLMCallableTool]):
|
|
|
123
123
|
self.register(f"{prefix}{name}", func)
|
|
124
124
|
logger.debug("Registered callable %s as %s", name, f"{prefix}{name}")
|
|
125
125
|
|
|
126
|
-
def get_schemas(self) -> list[
|
|
126
|
+
def get_schemas(self) -> list[schemez.OpenAIFunctionTool]:
|
|
127
127
|
"""Get schemas for all registered functions.
|
|
128
128
|
|
|
129
129
|
Returns:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|