| import sys | |
| import os | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) | |
| from huggingface_hub import InferenceClient | |
| from backend.app.config import config | |
| def verify_mistral(): | |
| print(f"Verifying {config.LLM_MODEL}...") | |
| try: | |
| client = InferenceClient(token=config.HUGGINGFACE_API_KEY) | |
| res = client.chat_completion( | |
| model=config.LLM_MODEL, | |
| messages=[{"role": "user", "content": "Hello!"}], | |
| max_tokens=20 | |
| ) | |
| print("Success!") | |
| print(res.choices[0].message.content) | |
| except Exception as e: | |
| print(f"Failed: {e}") | |
| if __name__ == "__main__": | |
| verify_mistral() | |