MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / completion_with_usage

Method completion_with_usage

src/harness/llms/client.py:150–159  ·  view source on GitHub ↗

Make a completion request and return response with usage stats.

(
        self,
        model: str,
        messages: List[Dict[str, Any]],
        **kwargs,
    )

Source from the content-addressed store, hash-verified

148 return litellm.completion(**completion_kwargs)
149
150 def completion_with_usage(
151 self,
152 model: str,
153 messages: List[Dict[str, Any]],
154 **kwargs,
155 ) -> Tuple[Any, Dict[str, int]]:
156 """Make a completion request and return response with usage stats."""
157 response = self.completion(model=model, messages=messages, **kwargs)
158 usage = extract_token_usage(response.usage)
159 return response, usage
160
161
162_default_client: Optional[LLMClient] = None

Callers

nothing calls this directly

Calls 2

completionMethod · 0.95
extract_token_usageFunction · 0.85

Tested by

no test coverage detected