11from abc import ABC
2- from typing import Any , Dict , List , Optional
2+ from typing import Any , Optional
33
44from ldai import log
5- from ldai .models import LDMessage
6- from ldai .providers .types import ModelResponse , StructuredResponse , ToolRegistry
5+ from ldai .providers .types import ToolRegistry
76
87
98class AIProvider (ABC ):
@@ -16,51 +15,6 @@ class AIProvider(ABC):
1615 create_model(), create_agent(), and create_agent_graph().
1716 """
1817
19- async def invoke_model (self , messages : List [LDMessage ]) -> ModelResponse :
20- """
21- Invoke the chat model with an array of messages.
22-
23- Default implementation takes no action and returns a placeholder response.
24- Provider implementations should override this method.
25-
26- :param messages: Array of LDMessage objects representing the conversation
27- :return: ModelResponse containing the model's response
28- """
29- log .warning ('invoke_model not implemented by this provider' )
30-
31- from ldai .models import LDMessage
32- from ldai .providers .types import LDAIMetrics
33-
34- return ModelResponse (
35- message = LDMessage (role = 'assistant' , content = '' ),
36- metrics = LDAIMetrics (success = False , usage = None ),
37- )
38-
39- async def invoke_structured_model (
40- self ,
41- messages : List [LDMessage ],
42- response_structure : Dict [str , Any ],
43- ) -> StructuredResponse :
44- """
45- Invoke the chat model with structured output support.
46-
47- Default implementation takes no action and returns a placeholder response.
48- Provider implementations should override this method.
49-
50- :param messages: Array of LDMessage objects representing the conversation
51- :param response_structure: Dictionary of output configurations keyed by output name
52- :return: StructuredResponse containing the structured data
53- """
54- log .warning ('invoke_structured_model not implemented by this provider' )
55-
56- from ldai .providers .types import LDAIMetrics
57-
58- return StructuredResponse (
59- data = {},
60- raw_response = '' ,
61- metrics = LDAIMetrics (success = False , usage = None ),
62- )
63-
6418 def create_model (self , config : Any ) -> Optional [Any ]:
6519 """
6620 Create a configured model executor for the given AI config.
0 commit comments