Skip to content

Commit 079c136

Browse files
committed
move type to judge and chat instead
1 parent 849a6f5 commit 079c136

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

packages/sdk/server-ai/src/ldai/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
__path__ = extend_path(__path__, __name__)
1010

1111
# Export chat
12-
from ldai.chat import TrackedChat
12+
from ldai.chat import ChatResponse, TrackedChat
1313
# Export main client
1414
from ldai.client import LDAIClient
1515
# Export judge
16-
from ldai.judge import AIJudge, EvalScore, JudgeResponse
16+
from ldai.judge import AIJudge, EvalScore, JudgeResponse, StructuredResponse
1717
# Export models for convenience
1818
from ldai.models import ( # Deprecated aliases for backward compatibility
1919
AIAgentConfig, AIAgentConfigDefault, AIAgentConfigRequest, AIAgents,
@@ -33,9 +33,11 @@
3333
'AIJudgeConfigDefault',
3434
'AIJudge',
3535
'TrackedChat',
36+
'ChatResponse',
3637
'EvalScore',
3738
'JudgeConfiguration',
3839
'JudgeResponse',
40+
'StructuredResponse',
3941
'LDMessage',
4042
'ModelConfig',
4143
'ProviderConfig',
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Chat module for LaunchDarkly AI SDK."""
22

33
from ldai.chat.tracked_chat import TrackedChat
4+
from ldai.chat.types import ChatResponse
45

5-
__all__ = ['TrackedChat']
6+
__all__ = ['TrackedChat', 'ChatResponse']

packages/sdk/server-ai/src/ldai/chat/tracked_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import logging
55
from typing import Dict, List, Optional
66

7+
from ldai.chat.types import ChatResponse
78
from ldai.judge import AIJudge
89
from ldai.judge.types import JudgeResponse
910
from ldai.models import AICompletionConfig, LDMessage
1011
from ldai.providers.ai_provider import AIProvider
11-
from ldai.providers.types import ChatResponse
1212
from ldai.tracker import LDAIConfigTracker
1313

1414

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Types for AI provider responses."""
1+
"""Types for chat responses."""
22

33
from dataclasses import dataclass
44
from typing import Any, List, Optional
@@ -15,13 +15,3 @@ class ChatResponse:
1515
message: LDMessage
1616
metrics: LDAIMetrics
1717
evaluations: Optional[List[Any]] = None # List of JudgeResponse, will be populated later
18-
19-
20-
@dataclass
21-
class StructuredResponse:
22-
"""
23-
Structured response from AI models.
24-
"""
25-
data: dict[str, Any]
26-
raw_response: str
27-
metrics: LDAIMetrics
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Judge module for LaunchDarkly AI SDK."""
22

33
from ldai.judge.ai_judge import AIJudge
4-
from ldai.judge.types import EvalScore, JudgeResponse
4+
from ldai.judge.types import EvalScore, JudgeResponse, StructuredResponse
55

6-
__all__ = ['AIJudge', 'EvalScore', 'JudgeResponse']
6+
__all__ = ['AIJudge', 'EvalScore', 'JudgeResponse', 'StructuredResponse']

packages/sdk/server-ai/src/ldai/judge/ai_judge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
import chevron
88

9+
from ldai.chat.types import ChatResponse
910
from ldai.judge.evaluation_schema_builder import EvaluationSchemaBuilder
10-
from ldai.judge.types import EvalScore, JudgeResponse
11+
from ldai.judge.types import EvalScore, JudgeResponse, StructuredResponse
1112
from ldai.models import AIJudgeConfig, LDMessage
1213
from ldai.providers.ai_provider import AIProvider
13-
from ldai.providers.types import ChatResponse, StructuredResponse
1414
from ldai.tracker import LDAIConfigTracker
1515

1616

packages/sdk/server-ai/src/ldai/judge/types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from dataclasses import dataclass
44
from typing import Any, Dict, Optional
55

6+
from ldai.metrics import LDAIMetrics
7+
68

79
@dataclass
810
class EvalScore:
@@ -42,3 +44,13 @@ def to_dict(self) -> Dict[str, Any]:
4244
if self.error is not None:
4345
result['error'] = self.error
4446
return result
47+
48+
49+
@dataclass
50+
class StructuredResponse:
51+
"""
52+
Structured response from AI models.
53+
"""
54+
data: dict[str, Any]
55+
raw_response: str
56+
metrics: LDAIMetrics

packages/sdk/server-ai/src/ldai/providers/ai_provider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from abc import ABC, abstractmethod
55
from typing import Any, Dict, List, Optional
66

7+
from ldai.chat.types import ChatResponse
8+
from ldai.judge.types import StructuredResponse
79
from ldai.metrics import LDAIMetrics
810
from ldai.models import AIConfigKind, LDMessage
9-
from ldai.providers.types import ChatResponse, StructuredResponse
1011

1112

1213
class AIProvider(ABC):

0 commit comments

Comments
 (0)