22 lines
591 B
Python
22 lines
591 B
Python
import httpx
|
|
from langchain_openai import ChatOpenAI
|
|
from app.core.config import settings
|
|
|
|
sync_client = httpx.Client(verify=False)
|
|
async_client = httpx.AsyncClient(verify=False)
|
|
|
|
llm = ChatOpenAI(
|
|
base_url=settings.llm_base_url,
|
|
api_key=settings.llm_api_key,
|
|
model=settings.llm_model,
|
|
temperature=0.3,
|
|
http_client=sync_client,
|
|
http_async_client=async_client
|
|
)
|
|
|
|
try:
|
|
print("\n=== Appell LLM... ===")
|
|
res = llm.invoke("Dis bonjour en un mot.")
|
|
print(f"Réponse du modèle : {res.content}")
|
|
except Exception as e:
|
|
print(f"\n❌ Erreur détectée : {e}") |