Fix MistralAI, symbol error caused it to fail to start

This commit is contained in:
Cyber MacGeddon 2025-03-25 19:12:00 +00:00
parent 222de268c7
commit fcb28e3a47

View file

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