|
5 | 5 | from typing import List |
6 | 6 |
|
7 | 7 | from litellm import acompletion |
8 | | -from typing import Dict |
9 | 8 |
|
10 | 9 | from eval_protocol.dataset_logger import default_logger |
11 | 10 | from eval_protocol.models import EvaluationRow, Message |
@@ -62,15 +61,10 @@ async def process_row(row: EvaluationRow) -> EvaluationRow: |
62 | 61 | if row.tools is not None: |
63 | 62 | request_params["tools"] = row.tools |
64 | 63 |
|
65 | | - # Dynamic import to avoid static dependency/lint errors if LiteLLM isn't installed yet |
66 | | - import importlib |
67 | | - |
68 | | - _litellm = importlib.import_module("litellm") |
69 | | - acompletion = getattr(_litellm, "acompletion") |
70 | 64 | response = await acompletion(**request_params) |
71 | 65 |
|
72 | | - assistant_content = response.choices[0].message.content or "" |
73 | | - tool_calls = response.choices[0].message.tool_calls if response.choices[0].message.tool_calls else None |
| 66 | + assistant_content = response.choices[0].message.content or "" # pyright: ignore[reportAttributeAccessIssue] |
| 67 | + tool_calls = response.choices[0].message.tool_calls if response.choices[0].message.tool_calls else None # pyright: ignore[reportAttributeAccessIssue] |
74 | 68 |
|
75 | 69 | converted_tool_calls = None |
76 | 70 | if tool_calls: |
@@ -112,9 +106,9 @@ async def process_row(row: EvaluationRow) -> EvaluationRow: |
112 | 106 | ] |
113 | 107 |
|
114 | 108 | row.execution_metadata.usage = CompletionUsage( |
115 | | - prompt_tokens=response.usage.prompt_tokens, |
116 | | - completion_tokens=response.usage.completion_tokens, |
117 | | - total_tokens=response.usage.total_tokens, |
| 109 | + prompt_tokens=response.usage.prompt_tokens, # pyright: ignore[reportAttributeAccessIssue] |
| 110 | + completion_tokens=response.usage.completion_tokens, # pyright: ignore[reportAttributeAccessIssue] |
| 111 | + total_tokens=response.usage.total_tokens, # pyright: ignore[reportAttributeAccessIssue] |
118 | 112 | ) |
119 | 113 |
|
120 | 114 | row.messages = messages |
|
0 commit comments