Repository navigation
Conversation
require_costs() returns (None, None) when a model has no pricing entry and no explicit cost override, matching every other provider adapter. KimiModel wrapped that result in float(), so constructing it with the shipped kimi-k2-base entry (or any id absent from KIMI_MODELS_DATA) raised TypeError before the client was ever built. Assign the costs directly, as the sibling adapters do, so calculate_cost() reports no cost instead.
|
@BlueX888 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KimiModel.__init__no longer raises when the selected model has no registry pricing. Unknown pricing is reported asNone, matching the other provider adapters.Why
require_costs()is typed-> Tuple[Optional[float], Optional[float]]and returnsNone, Nonewhen neither the registry entry nor an explicit/env cost override supplies pricing (deepeval/models/utils.py:112-158).KimiModel.__init__then coerced those values withfloat():deepeval/models/llms/kimi_model.py:88-89float(None)raisesTypeError, so construction fails synchronously, before any request is made. Two reachable paths:input_price=None/output_price=None—kimi-k2-base(deepeval/models/llms/constants.py:1051-1057);KIMI_MODELS_DATA, which falls back to the unpriced default model data (ModelDataRegistry.get,deepeval/models/llms/constants.py:42-53).Sibling adapters assign the
require_costs()result directly (deepeval/models/llms/deepseek_model.py:88-89,deepeval/models/llms/openai_model.py:122-123), andcalculate_cost()already treats a missing price as unknown.Changes
deepeval/models/llms/kimi_model.py— assigncost_per_input_token/cost_per_output_tokentomodel_data.input_price/model_data.output_pricewithout thefloat()coercion, as the sibling adapters do.tests/test_core/test_models/test_kimi_model.py— regression tests for both paths: a registry entry without pricing (kimi-k2-base) and an id absent from the registry (moonshot-v1-256k). Each asserts construction succeeds andcalculate_cost()returnsNone.Testing
python -m pytest tests/test_core/test_models/test_kimi_model.py -k constructs→2 failed,TypeError: float() argument must be a string or a real number, not 'NoneType'atkimi_model.py:88.2 passed.python -m pytest tests/test_core/test_models/test_kimi_model.py→8 passed.black --check(25.12.0, the version pinned in.github/workflows/black.yml) →2 files would be left unchanged.ruff check deepeval/models/llms/kimi_model.py tests/test_core/test_models/test_kimi_model.py→All checks passed!No API key or network is required; the tests stub the OpenAI clients via
tests/test_core/stubs.py(_RecordingClient).Fixes #3287