AbanteAI / rawdog

Generate and auto-execute Python scripts in the cli
Apache License 2.0
1.78k stars 137 forks source link

litellm.exceptions.NotFoundError: Model not in model_prices_and_context_window.json. You passed model=openai/mistral #83

Open snlt opened 7 months ago

snlt commented 7 months ago

litellm.exceptions.NotFoundError: Model not in model_prices_and_context_window.json. You passed model=openai/mistral

File ".../lib/python3.11/site-packages/rawdog/llm_client.py", line 115, in get_script:

            if custom_llm_provider:
                cost = 0
            else:
                cost = (
                    completion_cost(model=model, messages=messages, completion=text)
                    or 0
                )

Fixed:

            if custom_llm_provider:
                cost = 0
            else:
                try:
                    cost = (
                        completion_cost(model=model, messages=messages, completion=text)
                        or 0
                    )
                except Exception as e:
                    cost = 0

Done.