Fix/minor issues (#329)

* Fix MistralAI, symbol error caused it to fail to start

* Update templates
This commit is contained in:
cybermaggedon 2025-03-25 19:14:56 +00:00 committed by GitHub
parent 222de268c7
commit b1ab2938b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 9 deletions

View file

@ -4,7 +4,7 @@ Simple LLM service, performs text prompt completion using Mistral.
Input is prompt, output is response.
"""
from mistralai import Mistral, RateLimitError
from mistralai import Mistral
from prometheus_client import Histogram
import os
@ -130,12 +130,18 @@ class Processor(ConsumerProducer):
print("Done.", flush=True)
# FIXME: Wrong exception, don't know what this LLM throws
# for a rate limit
except Mistral.RateLimitError:
# FIXME: Wrong exception. The MistralAI library has retry logic
# so retry-able errors are retried transparently. It means we
# don't get rate limit events.
# Leave rate limit retries to the base handler
raise TooManyRequests()
# We could choose to turn off retry and handle all that here
# or subclass BackoffStrategy to keep the retry logic, but
# get the events out.
# except Mistral.RateLimitError:
# # Leave rate limit retries to the base handler
# raise TooManyRequests()
except Exception as e: