gaard-core 0.2.8__tar.gz → 0.2.10__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.
- {gaard_core-0.2.8 → gaard_core-0.2.10}/PKG-INFO +2 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/pyproject.toml +5 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/conversation_context/llm_classifier.py +3 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/conversation_context/mock_classifier.py +0 -1
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_intent/llm_classifier.py +3 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_pipeline/pipeline.py +1 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_classifier/llm_classifier.py +3 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_interpreter/llm_interpreter.py +3 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core.egg-info/PKG-INFO +2 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core.egg-info/requires.txt +1 -1
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_conversation_context_classifier.py +8 -4
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_json_utils.py +4 -4
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_llm_query_intent_classifier.py +10 -6
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_llm_result_classifier.py +5 -4
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_llm_result_interpreter.py +6 -5
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_llm_sql_generator.py +4 -3
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_query_pipeline.py +7 -2
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_schema_context_service.py +1 -1
- {gaard_core-0.2.8 → gaard_core-0.2.10}/README.md +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/setup.cfg +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/conversation_context/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/errors.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/execution/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/execution/mock_executor.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/json_utils.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/llm_output.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/conversation_context_prompt.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/intent_classification_prompt.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/models.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/result_classification_prompt.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/result_interpretation_prompt.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/schema_formatter.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/sql_generation_prompt.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/py.typed +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_intent/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_intent/mock_classifier.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_pipeline/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_pipeline/llm_sql_generator.py +4 -4
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_pipeline/mock_sql_generator.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/query_pipeline/models.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_classifier/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_classifier/mock_classifier.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_interpreter/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_interpreter/mock_interpreter.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/schema/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/schema/cache.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/schema/context.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/schema/models.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/sql_validator/__init__.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/sql_validator/select_only.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core.egg-info/SOURCES.txt +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core.egg-info/dependency_links.txt +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core.egg-info/top_level.txt +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_llm_output.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_result_classification_prompt_compiler.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_result_interpretation_prompt_compiler.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_schema_context_cache.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_schema_prompt_formatter.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_sql_generation_prompt_compiler.py +0 -0
- {gaard_core-0.2.8 → gaard_core-0.2.10}/tests/test_sql_validator.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gaard-core
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Core GAARD query pipeline, prompt compiler, policies and SQL validation
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.
|
|
7
|
+
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.10
|
|
8
8
|
Requires-Dist: pydantic>=2.7.0
|
|
9
9
|
Requires-Dist: sqlglot>=25.0.0
|
|
10
10
|
Provides-Extra: dev
|
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "gaard-core"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.10"
|
|
8
8
|
description = "Core GAARD query pipeline, prompt compiler, policies and SQL validation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"gaard-plugin-api>=0.2.
|
|
12
|
+
"gaard-plugin-api>=0.2.10,<0.3.0",
|
|
13
13
|
"pydantic>=2.7.0",
|
|
14
14
|
"sqlglot>=25.0.0",
|
|
15
15
|
]
|
|
@@ -25,5 +25,8 @@ dev = [
|
|
|
25
25
|
line-length = 100
|
|
26
26
|
target-version = "py311"
|
|
27
27
|
|
|
28
|
+
[tool.ruff.flake8-bugbear]
|
|
29
|
+
extend-immutable-calls = ["fastapi.Depends", "fastapi.param_functions.Depends", "fastapi.params.Depends"]
|
|
30
|
+
|
|
28
31
|
[tool.setuptools.packages.find]
|
|
29
32
|
where = ["src"]
|
{gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/conversation_context/llm_classifier.py
RENAMED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from typing import Any, Protocol, cast
|
|
3
3
|
|
|
4
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
5
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
6
|
+
|
|
4
7
|
from gaard_core.llm_output import remove_thinking_blocks
|
|
5
8
|
from gaard_core.prompt_compiler.conversation_context_prompt import (
|
|
6
9
|
ConversationContextPromptCompiler,
|
|
@@ -11,8 +14,6 @@ from gaard_core.query_pipeline.models import (
|
|
|
11
14
|
ConversationContextDecision,
|
|
12
15
|
QueryRequest,
|
|
13
16
|
)
|
|
14
|
-
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
15
|
-
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class ConversationContextPromptCompilerProtocol(Protocol):
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from typing import Any, Protocol, cast
|
|
3
3
|
|
|
4
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
5
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
6
|
+
|
|
4
7
|
from gaard_core.llm_output import remove_thinking_blocks
|
|
5
8
|
from gaard_core.prompt_compiler.intent_classification_prompt import (
|
|
6
9
|
IntentClassificationPromptCompiler,
|
|
@@ -11,8 +14,6 @@ from gaard_core.query_pipeline.models import (
|
|
|
11
14
|
QueryIntentDecision,
|
|
12
15
|
QueryRequest,
|
|
13
16
|
)
|
|
14
|
-
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
15
|
-
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class IntentPromptCompiler(Protocol):
|
|
@@ -3,9 +3,9 @@ import time
|
|
|
3
3
|
from collections.abc import Callable
|
|
4
4
|
from typing import Protocol
|
|
5
5
|
|
|
6
|
+
from gaard_core.errors import LlmProviderError, QueryPipelineStepError
|
|
6
7
|
from gaard_core.execution.mock_executor import MockQueryExecutor
|
|
7
8
|
from gaard_core.query_pipeline.mock_sql_generator import MockSqlGenerator
|
|
8
|
-
from gaard_core.errors import LlmProviderError, QueryPipelineStepError
|
|
9
9
|
from gaard_core.query_pipeline.models import (
|
|
10
10
|
GeneratedSql,
|
|
11
11
|
OutputClassification,
|
|
@@ -17,7 +17,6 @@ from gaard_core.result_classifier.mock_classifier import MockResultClassifier
|
|
|
17
17
|
from gaard_core.result_interpreter.mock_interpreter import MockResultInterpreter
|
|
18
18
|
from gaard_core.sql_validator.select_only import SelectOnlySqlValidator
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
logger = logging.getLogger(__name__)
|
|
22
21
|
|
|
23
22
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from typing import Any, Protocol
|
|
3
3
|
|
|
4
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
5
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
6
|
+
|
|
4
7
|
from gaard_core.llm_output import remove_thinking_blocks
|
|
5
8
|
from gaard_core.prompt_compiler.models import CompiledPrompt
|
|
6
9
|
from gaard_core.prompt_compiler.result_classification_prompt import (
|
|
7
10
|
ResultClassificationPromptCompiler,
|
|
8
11
|
)
|
|
9
12
|
from gaard_core.query_pipeline.models import OutputClassification, QueryRequest
|
|
10
|
-
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
11
|
-
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ClassificationPromptCompiler(Protocol):
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
from typing import Any, Protocol
|
|
2
2
|
|
|
3
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
4
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
5
|
+
|
|
3
6
|
from gaard_core.llm_output import remove_thinking_blocks
|
|
4
7
|
from gaard_core.prompt_compiler.models import CompiledPrompt
|
|
5
8
|
from gaard_core.prompt_compiler.result_interpretation_prompt import (
|
|
6
9
|
ResultInterpretationPromptCompiler,
|
|
7
10
|
)
|
|
8
11
|
from gaard_core.query_pipeline.models import QueryRequest, QueryResult
|
|
9
|
-
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
10
|
-
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class ResultPromptCompiler(Protocol):
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gaard-core
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.10
|
|
4
4
|
Summary: Core GAARD query pipeline, prompt compiler, policies and SQL validation
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.
|
|
7
|
+
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.10
|
|
8
8
|
Requires-Dist: pydantic>=2.7.0
|
|
9
9
|
Requires-Dist: sqlglot>=25.0.0
|
|
10
10
|
Provides-Extra: dev
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
3
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
4
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatCompletionResponse
|
|
5
|
+
|
|
1
6
|
from gaard_core.conversation_context.llm_classifier import (
|
|
2
7
|
LlmConversationContextClassifier,
|
|
3
8
|
parse_conversation_context_classification,
|
|
4
9
|
)
|
|
5
10
|
from gaard_core.conversation_context.mock_classifier import MockConversationContextClassifier
|
|
6
11
|
from gaard_core.query_pipeline.models import ConversationContextDecision, QueryRequest
|
|
7
|
-
from gaard_llm.providers.models import ChatCompletionResponse
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
def test_parse_conversation_context_classification_handles_aliases_and_invalid_values() -> None:
|
|
@@ -32,9 +36,9 @@ def test_parse_conversation_context_classification_handles_aliases_and_invalid_v
|
|
|
32
36
|
def test_llm_conversation_context_classifier_exposes_prompt_and_standalone_follow_up() -> None:
|
|
33
37
|
class FakeClient:
|
|
34
38
|
def __init__(self) -> None:
|
|
35
|
-
self.request = None
|
|
39
|
+
self.request: ChatCompletionRequest | None = None
|
|
36
40
|
|
|
37
|
-
def create_chat_completion(self, request):
|
|
41
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
38
42
|
self.request = request
|
|
39
43
|
return ChatCompletionResponse(
|
|
40
44
|
content=(
|
|
@@ -46,7 +50,7 @@ def test_llm_conversation_context_classifier_exposes_prompt_and_standalone_follo
|
|
|
46
50
|
|
|
47
51
|
client = FakeClient()
|
|
48
52
|
classifier = LlmConversationContextClassifier(
|
|
49
|
-
client=client,
|
|
53
|
+
client=cast(OpenAICompatibleClient, client),
|
|
50
54
|
model="test-model",
|
|
51
55
|
)
|
|
52
56
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import date, datetime
|
|
1
|
+
from datetime import UTC, date, datetime
|
|
2
2
|
from decimal import Decimal
|
|
3
3
|
|
|
4
4
|
from gaard_core.json_utils import json_dumps, to_jsonable
|
|
@@ -7,10 +7,10 @@ from gaard_core.json_utils import json_dumps, to_jsonable
|
|
|
7
7
|
def test_to_jsonable_normalizes_common_database_values() -> None:
|
|
8
8
|
assert to_jsonable(
|
|
9
9
|
{
|
|
10
|
-
"integer_decimal": Decimal(
|
|
10
|
+
"integer_decimal": Decimal(30),
|
|
11
11
|
"fractional_decimal": Decimal("30.5"),
|
|
12
12
|
"event_date": date(2026, 5, 24),
|
|
13
|
-
"event_time": datetime(2026, 5, 24, 9, 30),
|
|
13
|
+
"event_time": datetime(2026, 5, 24, 9, 30, tzinfo=UTC).replace(tzinfo=None),
|
|
14
14
|
"payload": b"ok",
|
|
15
15
|
"binary_payload": b"\xff",
|
|
16
16
|
}
|
|
@@ -25,6 +25,6 @@ def test_to_jsonable_normalizes_common_database_values() -> None:
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def test_json_dumps_serializes_common_database_values() -> None:
|
|
28
|
-
payload = {"rows": [{"total_minutes": Decimal(
|
|
28
|
+
payload = {"rows": [{"total_minutes": Decimal(42)}]}
|
|
29
29
|
|
|
30
30
|
assert '"total_minutes": 42' in json_dumps(payload)
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
from typing import cast
|
|
2
|
+
|
|
3
|
+
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
4
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatCompletionResponse
|
|
5
|
+
|
|
1
6
|
from gaard_core.query_intent.llm_classifier import (
|
|
2
7
|
LlmQueryIntentClassifier,
|
|
3
8
|
parse_query_intent_classification,
|
|
4
9
|
)
|
|
5
10
|
from gaard_core.query_pipeline.models import QueryIntentDecision, QueryRequest
|
|
6
|
-
from gaard_llm.providers.models import ChatCompletionResponse
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
class FakeLlmClient:
|
|
10
|
-
def create_chat_completion(self, request):
|
|
14
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
11
15
|
return ChatCompletionResponse(
|
|
12
16
|
content=(
|
|
13
17
|
'{"decision":"write_or_mutation_request",'
|
|
@@ -21,9 +25,9 @@ class FakeLlmClient:
|
|
|
21
25
|
|
|
22
26
|
class CapturingLlmClient:
|
|
23
27
|
def __init__(self) -> None:
|
|
24
|
-
self.requests = []
|
|
28
|
+
self.requests: list[ChatCompletionRequest] = []
|
|
25
29
|
|
|
26
|
-
def create_chat_completion(self, request):
|
|
30
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
27
31
|
self.requests.append(request)
|
|
28
32
|
|
|
29
33
|
return ChatCompletionResponse(
|
|
@@ -35,7 +39,7 @@ class CapturingLlmClient:
|
|
|
35
39
|
|
|
36
40
|
def test_llm_query_intent_classifier_returns_model_decision() -> None:
|
|
37
41
|
classifier = LlmQueryIntentClassifier(
|
|
38
|
-
client=FakeLlmClient(),
|
|
42
|
+
client=cast(OpenAICompatibleClient, FakeLlmClient()),
|
|
39
43
|
model="test-model",
|
|
40
44
|
)
|
|
41
45
|
|
|
@@ -56,7 +60,7 @@ def test_llm_query_intent_classifier_returns_model_decision() -> None:
|
|
|
56
60
|
def test_llm_query_intent_classifier_sends_provider_extra_body() -> None:
|
|
57
61
|
client = CapturingLlmClient()
|
|
58
62
|
classifier = LlmQueryIntentClassifier(
|
|
59
|
-
client=client,
|
|
63
|
+
client=cast(OpenAICompatibleClient, client),
|
|
60
64
|
model="test-model",
|
|
61
65
|
extra_body={
|
|
62
66
|
"chat_template_kwargs": {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatCompletionResponse
|
|
2
|
+
|
|
1
3
|
from gaard_core.query_pipeline.models import OutputClassification, QueryRequest
|
|
2
4
|
from gaard_core.result_classifier.llm_classifier import (
|
|
3
5
|
LlmResultClassifier,
|
|
4
6
|
parse_output_classification,
|
|
5
7
|
)
|
|
6
|
-
from gaard_llm.providers.models import ChatCompletionResponse
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class FakeLlmClient:
|
|
10
|
-
def create_chat_completion(self, request):
|
|
11
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
11
12
|
return ChatCompletionResponse(
|
|
12
13
|
content='{"output_classification": "personal_data"}',
|
|
13
14
|
model="test-model",
|
|
@@ -17,9 +18,9 @@ class FakeLlmClient:
|
|
|
17
18
|
|
|
18
19
|
class CapturingLlmClient:
|
|
19
20
|
def __init__(self) -> None:
|
|
20
|
-
self.requests = []
|
|
21
|
+
self.requests: list[ChatCompletionRequest] = []
|
|
21
22
|
|
|
22
|
-
def create_chat_completion(self, request):
|
|
23
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
23
24
|
self.requests.append(request)
|
|
24
25
|
|
|
25
26
|
return ChatCompletionResponse(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatCompletionResponse
|
|
2
|
+
|
|
1
3
|
from gaard_core.query_pipeline.models import QueryRequest, QueryResult
|
|
2
4
|
from gaard_core.result_interpreter.llm_interpreter import LlmResultInterpreter
|
|
3
|
-
from gaard_llm.providers.models import ChatCompletionResponse
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class FakeLlmClient:
|
|
7
|
-
def create_chat_completion(self, request):
|
|
8
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
8
9
|
return ChatCompletionResponse(
|
|
9
10
|
content="W bazie znajduje się 4 aktywnych pacjentów.",
|
|
10
11
|
model="test-model",
|
|
@@ -14,9 +15,9 @@ class FakeLlmClient:
|
|
|
14
15
|
|
|
15
16
|
class CapturingLlmClient:
|
|
16
17
|
def __init__(self) -> None:
|
|
17
|
-
self.requests = []
|
|
18
|
+
self.requests: list[ChatCompletionRequest] = []
|
|
18
19
|
|
|
19
|
-
def create_chat_completion(self, request):
|
|
20
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
20
21
|
self.requests.append(request)
|
|
21
22
|
|
|
22
23
|
return ChatCompletionResponse(
|
|
@@ -46,7 +47,7 @@ def test_llm_result_interpreter_returns_model_content() -> None:
|
|
|
46
47
|
|
|
47
48
|
def test_llm_result_interpreter_removes_thinking_blocks() -> None:
|
|
48
49
|
class ThinkingFakeLlmClient:
|
|
49
|
-
def create_chat_completion(self, request):
|
|
50
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
50
51
|
return ChatCompletionResponse(
|
|
51
52
|
content=(
|
|
52
53
|
"<think>\n"
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
from gaard_llm.providers.models import ChatCompletionRequest, ChatCompletionResponse
|
|
2
|
+
|
|
1
3
|
from gaard_core.query_pipeline.llm_sql_generator import LlmSqlGenerator
|
|
2
4
|
from gaard_core.query_pipeline.models import QueryRequest
|
|
3
|
-
from gaard_llm.providers.models import ChatCompletionResponse
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class CapturingClient:
|
|
7
8
|
def __init__(self) -> None:
|
|
8
|
-
self.requests = []
|
|
9
|
+
self.requests: list[ChatCompletionRequest] = []
|
|
9
10
|
|
|
10
|
-
def create_chat_completion(self, request):
|
|
11
|
+
def create_chat_completion(self, request: ChatCompletionRequest) -> ChatCompletionResponse:
|
|
11
12
|
self.requests.append(request)
|
|
12
13
|
|
|
13
14
|
return ChatCompletionResponse(
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
|
|
3
3
|
from gaard_core.errors import LlmProviderError, QueryPipelineStepError
|
|
4
|
-
from gaard_core.query_pipeline.models import
|
|
4
|
+
from gaard_core.query_pipeline.models import (
|
|
5
|
+
GeneratedSql,
|
|
6
|
+
OutputClassification,
|
|
7
|
+
QueryRequest,
|
|
8
|
+
QueryResult,
|
|
9
|
+
)
|
|
5
10
|
from gaard_core.query_pipeline.pipeline import QueryPipeline
|
|
6
11
|
|
|
7
12
|
|
|
@@ -46,7 +51,7 @@ class FailingInterpreter:
|
|
|
46
51
|
|
|
47
52
|
|
|
48
53
|
class FailingClassifier:
|
|
49
|
-
def classify(self, request: QueryRequest, answer: str):
|
|
54
|
+
def classify(self, request: QueryRequest, answer: str) -> OutputClassification:
|
|
50
55
|
raise AssertionError("classifier should not be called")
|
|
51
56
|
|
|
52
57
|
|
|
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
|
{gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/conversation_context_prompt.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/prompt_compiler/sql_generation_prompt.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Protocol
|
|
3
3
|
|
|
4
|
-
from gaard_core.prompt_compiler.models import CompiledPrompt, SqlGenerationPromptRequest
|
|
5
|
-
from gaard_core.prompt_compiler.sql_generation_prompt import SqlGenerationPromptCompiler
|
|
6
|
-
from gaard_core.llm_output import remove_thinking_blocks
|
|
7
|
-
from gaard_core.query_pipeline.models import GeneratedSql, QueryRequest
|
|
8
4
|
from gaard_llm.openai_compatible.client import OpenAICompatibleClient
|
|
9
5
|
from gaard_llm.providers.models import ChatCompletionRequest, ChatMessage
|
|
10
6
|
|
|
7
|
+
from gaard_core.llm_output import remove_thinking_blocks
|
|
8
|
+
from gaard_core.prompt_compiler.models import CompiledPrompt, SqlGenerationPromptRequest
|
|
9
|
+
from gaard_core.prompt_compiler.sql_generation_prompt import SqlGenerationPromptCompiler
|
|
10
|
+
from gaard_core.query_pipeline.models import GeneratedSql, QueryRequest
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gaard_core-0.2.8 → gaard_core-0.2.10}/src/gaard_core/result_interpreter/mock_interpreter.py
RENAMED
|
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
|