We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c89641d commit f30064aCopy full SHA for f30064a
src/agentlab/llm/chat_api.py
@@ -251,8 +251,15 @@ def __init__(
251
# Get pricing information
252
if pricing_func:
253
pricings = pricing_func()
254
- self.input_cost = float(pricings[model_name]["prompt"])
255
- self.output_cost = float(pricings[model_name]["completion"])
+ try:
+ self.input_cost = float(pricings[model_name]["prompt"])
256
+ self.output_cost = float(pricings[model_name]["completion"])
257
+ except KeyError:
258
+ logging.warning(
259
+ f"Model {model_name} not found in the pricing information, prices are set to 0. Maybe try upgrading langchain_community."
260
+ )
261
+ self.input_cost = 0.0
262
+ self.output_cost = 0.0
263
else:
264
self.input_cost = 0.0
265
self.output_cost = 0.0
0 commit comments