File tree Expand file tree Collapse file tree 2 files changed +0
-34
lines changed
packages/ai-providers/server-ai-langchain Expand file tree Collapse file tree 2 files changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -204,19 +204,6 @@ def get_ai_metrics_from_response(response: BaseMessage) -> LDAIMetrics:
204204 # LangChain responses that complete successfully are considered successful by default
205205 return LDAIMetrics (success = True , usage = usage )
206206
207- @staticmethod
208- def create_ai_metrics (langchain_response : BaseMessage ) -> LDAIMetrics :
209- """
210- Create AI metrics information from a LangChain provider response.
211-
212- .. deprecated::
213- Use `get_ai_metrics_from_response()` instead.
214-
215- :param langchain_response: The response from the LangChain model
216- :return: LDAIMetrics with success status and token usage
217- """
218- return LangChainProvider .get_ai_metrics_from_response (langchain_response )
219-
220207 @staticmethod
221208 def convert_messages_to_langchain (
222209 messages : List [LDMessage ],
Original file line number Diff line number Diff line change @@ -256,24 +256,3 @@ def test_returns_underlying_llm(self):
256256 assert provider .get_chat_model () is mock_llm
257257
258258
259- class TestCreateAIMetrics :
260- """Tests for deprecated create_ai_metrics static method."""
261-
262- def test_delegates_to_get_ai_metrics_from_response (self ):
263- """Should delegate to get_ai_metrics_from_response."""
264- mock_response = AIMessage (content = 'Test response' )
265- mock_response .response_metadata = {
266- 'tokenUsage' : {
267- 'totalTokens' : 100 ,
268- 'promptTokens' : 50 ,
269- 'completionTokens' : 50 ,
270- },
271- }
272-
273- result = LangChainProvider .create_ai_metrics (mock_response )
274- expected = LangChainProvider .get_ai_metrics_from_response (mock_response )
275-
276- assert result .success == expected .success
277- assert result .usage .total == expected .usage .total
278- assert result .usage .input == expected .usage .input
279- assert result .usage .output == expected .usage .output
You can’t perform that action at this time.
0 commit comments