mirror of
https://github.com/Ladebeze66/llm_ticket3.git
synced 2025-12-16 00:36:52 +01:00
32 lines
886 B
Python
32 lines
886 B
Python
from .base_llm import BaseLLM
|
|
import requests
|
|
|
|
class PixtralMedium(BaseLLM):
|
|
|
|
def __init__(self):
|
|
super().__init__("pixtral-medium-latest")
|
|
self.configurer(temperature=0.2, top_p=1)
|
|
|
|
def urlBase(self) -> str:
|
|
return "https://api.mistral.ai/v1/"
|
|
|
|
def cleAPI(self) -> str:
|
|
return "2iGzTzE9csRQ9IoASoUjplHwEjA200Vh"
|
|
|
|
def urlFonction(self) -> str:
|
|
return "chat/completions"
|
|
|
|
def _preparer_contenu(self, question: str) -> dict:
|
|
return {
|
|
"model": self.modele,
|
|
"messages": [
|
|
{"role": "system", "content": self.prompt_system},
|
|
{"role": "user", "content": question}
|
|
],
|
|
**self.params
|
|
}
|
|
|
|
def _traiter_reponse(self, reponse: requests.Response) -> str:
|
|
data = reponse.json()
|
|
return data["choices"][0]["message"]["content"]
|