<?xml
version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:atom="http://www.w3.org/2005/Atom"
>

<channel xml:lang="fr">
	<title>Les services IA de DnC</title>
	<link>https://ia.dnc.global/</link>
	<description>En mati&#232;re d'intelligence artificielle (IA), DnC met l'accent sur la s&#233;curit&#233; en offrant aux entreprises le moyen de conserver leurs donn&#233;es et les traitements &#224; l'int&#233;rieur de leur r&#233;seau d'entreprise plut&#244;t que dans le Cloud.</description>
	<language>fr</language>
	<generator>SPIP - www.spip.net</generator>
	<atom:link href="https://ia.dnc.global/spip.php?id_auteur=1&amp;page=backend" rel="self" type="application/rss+xml" />




<item xml:lang="fr">
		<title>Comment ReActAgent s'ins&#232;re dans le Workflow LlamaIndex</title>
		<link>https://ia.dnc.global/Comment-ReActAgent-s-insere-dans-le-Workflow-LlamaIndex.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/Comment-ReActAgent-s-insere-dans-le-Workflow-LlamaIndex.html</guid>
		<dc:date>2026-04-13T10:15:10Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Dans LlamaIndex, la boucle ReAct repose sur un principe simple : le workflow orchestre, l'agent raisonne. &#192; chaque appel, g&#233;n&#232;re un prompt, interroge le LLM, reconstruit une &#233;tape de raisonnement et laisse le finalizer d&#233;cider de la suite. Une m&#233;canique minimale c&#244;t&#233; workflow, une intelligence maximale c&#244;t&#233; agent. &lt;br class='autobr' /&gt; #La boucle de raisonnement ReAct &lt;br class='autobr' /&gt;
##Comment `ReActAgent` s'ins&#232;re dans le Workflow LlamaIndex &lt;br class='autobr' /&gt;
LlamaIndex ReActAgent, construit sur Workflow, fournit le code du **step** dans un workflow. (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-Architecture-et-traitements-.html" rel="directory"&gt;Architecture et traitements&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Dans LlamaIndex, la boucle ReAct repose sur un principe simple : le workflow orchestre, l'agent raisonne. &#192; chaque appel, g&#233;n&#232;re un prompt, interroge le LLM, reconstruit une &#233;tape de raisonnement et laisse le finalizer d&#233;cider de la suite. Une m&#233;canique minimale c&#244;t&#233; workflow, une intelligence maximale c&#244;t&#233; agent.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h1&gt;La boucle de raisonnement ReAct&lt;/h1&gt;
&lt;h2&gt;Comment &lt;code&gt;ReActAgent&lt;/code&gt; s'ins&#232;re dans le Workflow LlamaIndex&lt;/h2&gt;
&lt;p&gt;LlamaIndex ReActAgent, construit sur Workflow, fournit le code du &lt;strong&gt;step&lt;/strong&gt; dans un workflow. Le workflow appelle :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;BaseAgent.run_agent_step() &#8594; ReActAgent.take_step()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Donc :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;le workflow = &lt;strong&gt;chef d'orchestre&lt;/strong&gt; (encore un !)&lt;/li&gt;
&lt;li&gt;l'agent = &lt;strong&gt;une &#233;tape du workflow&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;take_step()&lt;/code&gt; = &lt;strong&gt;la logique ReAct pour une &#233;tape&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Comment sont construites les steps ReAct ?&lt;/h2&gt;
&lt;p&gt;En v&#233;rit&#233; : Le Workflow ne construit pas des steps ReAct. C'est ReActAgent qui les fait construire par le LLM.
Le Workflow ne fait que :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;appeler &lt;code&gt;take_step()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;attendre un &lt;code&gt;AgentStepOutput&lt;/code&gt; (Thought, Action, Action Input ...)&lt;/li&gt;
&lt;li&gt;d&#233;cider avec ReActFinalizer si une nouvelle &#233;tape doit &#234;tre ex&#233;cut&#233;e&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Voici ce qui se passe dans &lt;code&gt;ReActAgent.take_step()&lt;/code&gt; pour construire une &#233;tape :&lt;/p&gt;
&lt;h3&gt;&#201;tape 1 &#8212; Construire le prompt ReAct&lt;/h3&gt;
&lt;p&gt;L'agent g&#233;n&#232;re le prompt ReAct qui fixe les r&#232;gles que devra suivre le LLM pour &#233;laborer les THOUGHT, ACTION et ACTION INPUT, pour appeler les outils etc. Le prompt contient &#233;galement l'historique des &#233;changes et, in fine, la question de l'utilisateur. Voici un exemple tr&#232;s na&#239;f :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;You are a ReAct agent.
First, think step-by-step and write:
THOUGHT:
Then, if needed, write:
ACTION:
ACTION INPUT:
&lt;context&gt;
&lt;query&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;&#201;tape 2 &#8212; Appeler le LLM&lt;/h3&gt;
&lt;p&gt;L'agent appelle :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;llm.stream(prompt)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le LLM g&#233;n&#232;re la r&#233;ponse au prompt. &#8594; Le LLM produit progressivement, par petits fragments, les &lt;strong&gt;deltas&lt;/strong&gt;. &lt;/p&gt;
&lt;h3&gt;&#201;tape 3 &#8212; Le parser reconstruit les blocs&lt;/h3&gt;
&lt;p&gt;Le &lt;code&gt;ReActStreamParser&lt;/code&gt; transforme les deltas en blocs :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;THOUGHT: ...
ACTION: ...
OBSERVATION: ...
...
FINAL_ANSWER: ...&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;&#201;tape 4 &#8212; Le ReActFinalizer d&#233;cide si l'&#233;tape est termin&#233;e&lt;/h3&gt;
&lt;p&gt;Le finalizer :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;valide les blocs&lt;/li&gt;
&lt;li&gt;d&#233;tecte les erreurs&lt;/li&gt;
&lt;li&gt;emp&#234;che les boucles&lt;/li&gt;
&lt;li&gt;d&#233;cide si une nouvelle &#233;tape doit &#234;tre lanc&#233;e&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&#201;tape 5 &#8212; Le workflow relance &lt;code&gt;take_step()&lt;/code&gt; si n&#233;cessaire&lt;/h3&gt;
&lt;p&gt;Si le finalizer dit &#8220;continue&#8221;, alors :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;workflow &#8594; BaseAgent.run_agent_step &#8594; ReActAgent.take_step()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Et une nouvelle &#233;tape ReAct est produite.&lt;/p&gt;
&lt;h3&gt;En r&#233;sum&#233; : r&#244;le du Workflow&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Le workflow LlamaIndex ne fait qu'appeler &lt;code&gt;take_step()&lt;/code&gt; en boucle.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ReActAgent.take_step()&lt;/code&gt; g&#233;n&#232;re une &lt;em&gt;&#233;tape ReAct&lt;/em&gt; en appelant le LLM.&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;ReActStreamParser&lt;/code&gt; reconstruit les blocs ReAct &#224; partir des deltas.&lt;/li&gt;
&lt;li&gt;Le &lt;code&gt;ReActFinalizer&lt;/code&gt; d&#233;cide si une nouvelle &#233;tape doit &#234;tre lanc&#233;e.&lt;/li&gt;
&lt;li&gt;Le workflow relance &lt;code&gt;take_step()&lt;/code&gt; si n&#233;cessaire.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class='spip_document_26 spip_documents spip_documents_center'&gt;
&lt;img src='https://ia.dnc.global/local/cache-vignettes/L428xH753/bouclereact_1-e5172.png?1776293294' width='428' height='753' alt=&#034;&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Voyez aussi :&lt;/strong&gt;
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; &lt;a href='https://ia.dnc.global/ReActEngine-v1-Modules-et-traitements.html' class='spip_in'&gt;ReActEngine v1 : Modules et traitements&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>ReActEngine v1 : Finalizer et StreamParser</title>
		<link>https://ia.dnc.global/Architecture-ReAct-Finalizer-et-StreamParser.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/Architecture-ReAct-Finalizer-et-StreamParser.html</guid>
		<dc:date>2026-04-13T09:34:02Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Les modules ReActFinalizer, ReActStreamParser, font partie du niveau sup&#233;rieur ou &#034;Orchesrtrateur&#034; di traitement. Ils ont &#233;t&#233; d&#233;velopp&#233;s sp&#233;cialement pour atteindre les objectifs du ReActEngine v1. Architecture ReAct : Finalizer et StreamParser R&#244;les et responsabilit&#233;s ReActStreamParser &lt;br class='autobr' /&gt;
Fait le lien entre le niveau applicatif et le ReActEngine. &lt;br class='autobr' /&gt;
Responsable de : La segmentation du flux brut en blocs ReActBlock L'identification du type de chaque bloc (ReActType) La gestion du buffer et du flush (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Les modules ReActFinalizer, ReActStreamParser, font partie du niveau sup&#233;rieur ou &#034;Orchesrtrateur&#034; di traitement. Ils ont &#233;t&#233; d&#233;velopp&#233;s sp&#233;cialement pour atteindre les objectifs du &lt;a href='https://ia.dnc.global/ReActEngine-v1-Modules-et-traitements.html' class='spip_in'&gt;ReActEngine v1&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h1&gt;Architecture ReAct : Finalizer et StreamParser&lt;/h1&gt;
&lt;h2&gt;R&#244;les et responsabilit&#233;s&lt;/h2&gt;
&lt;h3&gt;ReActStreamParser&lt;/h3&gt;
&lt;p&gt;Fait le lien entre le niveau applicatif et le ReActEngine.&lt;/p&gt;
&lt;p&gt;Responsable de :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;La segmentation du flux brut en blocs &lt;code&gt;ReActBlock&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'identification du type de chaque bloc (&lt;code&gt;ReActType&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;La gestion du buffer et du flush final&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;La conservation de l'historique des blocs extraits&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Ne d&#233;cide jamais de l'arr&#234;t ou de la modification du raisonnement.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Expose :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;has_final_answer()&lt;/code&gt; : indique si un bloc &lt;code&gt;FINAL_ANSWER&lt;/code&gt; est pr&#233;sent dans les blocs extraits&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;get_final_answer()&lt;/code&gt; : retourne le contenu du dernier bloc &lt;code&gt;FINAL_ANSWER&lt;/code&gt; si pr&#233;sent&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;ReActFinalizer&lt;/h3&gt;
&lt;p&gt;Responsable de :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;L'orchestration du raisonnement jusqu'&#224; r&#233;solution&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'arr&#234;t du flux d&#232;s qu'un bloc de type &lt;code&gt;FINAL_ANSWER&lt;/code&gt;, &lt;code&gt;ANSWER&lt;/code&gt;, &lt;code&gt;RESPONSE&lt;/code&gt; ou &lt;code&gt;CONCLUSION&lt;/code&gt; est rencontr&#233;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;La d&#233;tection de boucles ou d'anomalies de raisonnement, avec relance du raisonnement via un &lt;a href='https://ia.dnc.global/ReActEngine-v1-traitement-des-erreurs.html' class='spip_in'&gt;Thought inject&#233;&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Ne conna&#238;t pas l'&#233;tat interne du parser.&lt;/strong&gt; Il ne peut pas appeler &lt;code&gt;parser.has_final_answer()&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;R&#232;gle de s&#233;paration stricte&lt;/h2&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Le &lt;code&gt;Finalizer&lt;/code&gt; ne doit pas inspecter &lt;code&gt;parser.blocks&lt;/code&gt; ni utiliser ses m&#233;thodes internes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le &lt;code&gt;Parser&lt;/code&gt; ne doit pas d&#233;cider de l'arr&#234;t ou la modification du raisonnement.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;La d&#233;tection de la r&#233;solution se fait uniquement dans le &lt;code&gt;Finalizer&lt;/code&gt;, en fonction du type des blocs yield&#233;s.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;Exemple de flux&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&#034;language-text&#034;&gt;Thought: I need to search.
Action: search[weather]
Observation: It's raining.
Final Answer: Bring an umbrella.&lt;/code&gt;&lt;/pre&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Le &lt;code&gt;Parser&lt;/code&gt; extrait 4 blocs typ&#233;s.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le &lt;code&gt;Finalizer&lt;/code&gt; s'arr&#234;te d&#232;s r&#233;ception du bloc &lt;code&gt;FINAL_ANSWER&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;La classe &lt;code&gt;ReActType&lt;/code&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;H&#233;ritage :&lt;/strong&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;class ReActType(str, Enum):&lt;/code&gt;&lt;/pre&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;H&#233;rite de &lt;code&gt;str&lt;/code&gt; pour permettre des comparaisons directes avec des cha&#238;nes (&lt;code&gt;block.type == &#034;thought&#034;&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;H&#233;rite de &lt;code&gt;Enum&lt;/code&gt; pour garantir l'&#233;num&#233;ration stricte des types.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;Types ReAct fondamentaux&lt;/strong&gt;&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;R&#244;le dans le flux ReAct&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;THOUGHT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Raisonnement interne&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ACTION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Appel d'outil&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OBSERVATION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;sultat d'outil&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FINAL_ANSWER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cl&#244;ture explicite&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ANSWER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;ponse directe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RESPONSE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Variante de r&#233;ponse&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CONCLUSION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Cl&#244;ture synth&#233;tique&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TOOL_CALL&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Appel structur&#233; (optionnel)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TOOL_RESULT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;sultat structur&#233;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;UNKNOWN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Valeur de secours&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;3. &lt;strong&gt;Coh&#233;rence avec les finalizers et parsers&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Les types &lt;code&gt;FINAL_ANSWER&lt;/code&gt;, &lt;code&gt;ANSWER&lt;/code&gt;, &lt;code&gt;RESPONSE&lt;/code&gt;, &lt;code&gt;CONCLUSION&lt;/code&gt; sont utilis&#233;s comme &lt;strong&gt;types de cl&#244;ture&lt;/strong&gt; dans le &lt;code&gt;Finalizer&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Les types &lt;code&gt;TOOL_CALL&lt;/code&gt; et &lt;code&gt;TOOL_RESULT&lt;/code&gt; sont utiles pour des flux structur&#233;s (JSON, agents avanc&#233;s).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;UNKNOWN&lt;/code&gt; est une bonne pratique pour la robustesse du parsing.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Pourquoi deux parsers ?&lt;/h1&gt;
&lt;p&gt;Les parsers ont pour fonction d'assembler un flux de r&#233;ponse brut (les tokens) en messages typ&#233;s ReAct.&lt;/p&gt;
&lt;p&gt;Les lecteurs attentifs auront remarqu&#233; que :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;il existe un ReActOutputParser directement &#224; la sortie du LLM et, pourtant, ReActEngine &#233;met un flux brut de token ;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'application cliente doit reconstruire les messages ReAct, par exemple avec StreamlitChatTracer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Voici la distinction essentielle &#8212; et pourquoi elle est &lt;strong&gt;n&#233;cessaire&lt;/strong&gt; &#8212; entre :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActOutputParser&lt;/strong&gt; (c&#244;t&#233; LLM, logique interne de l'agent)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActEngine / Workflow&lt;/strong&gt; (c&#244;t&#233; runtime, flux brut de tokens)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;StreamlitChatTracer / client&lt;/strong&gt; (c&#244;t&#233; application, reconstruction des messages)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;dl class='spip_document_29 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/reactengine_2parser_diagram_20260408.png' class=&#034;mediabox&#034; title=&#034;Deux parser en parall&#232;le avec des objectifs et une temporalit&#233; diff&#233;rents&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH282/reactengine_2parser_diagram_20260408-cd6fe.png?1776303650' width='500' height='282' alt=&#034;PNG - 1.3&#160;Mo&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-29 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;Deux parser en parall&#232;le avec des objectifs et une temporalit&#233; diff&#233;rents &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;h2&gt;&lt;strong&gt;1. Le ReActOutputParser n'est &lt;em&gt;pas&lt;/em&gt; utilis&#233; pendant le streaming&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;ReActOutputParser&lt;/strong&gt; est con&#231;u pour analyser &lt;strong&gt;un bloc complet&lt;/strong&gt; de texte produit par le LLM, contenant typiquement :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Thought: ...
Action: tool_name
Action Input: {...}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ou bien :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Thought: ...
Answer: ...&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ce parser fonctionne &lt;strong&gt;uniquement&lt;/strong&gt; lorsque le LLM a fini de produire &lt;strong&gt;tout&lt;/strong&gt; le message.&lt;br /&gt;
Il ne peut pas fonctionner sur un flux token-par-token, car :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;le pattern ReAct n'est pas encore complet,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;les sections Thought / Action / Observation / Answer peuvent arriver dans n'importe quel ordre,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;le LLM peut r&#233;viser sa sortie en cours de g&#233;n&#233;ration.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Donc : pendant le streaming, LlamaIndex ne peut pas appliquer ReActOutputParser.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;2. Pourquoi ReActEngine &#233;met un flux brut de tokens&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Le moteur ReAct dans LlamaIndex Workflow est con&#231;u pour :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;exposer l'int&#233;gralit&#233; du raisonnement ReAct&lt;/strong&gt;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;permettre au client de suivre la progression en temps r&#233;el&lt;/strong&gt;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;laisser la libert&#233; au d&#233;veloppeur de tracer, filtrer ou visualiser les &#233;tapes&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le flux brut contient donc :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;les &lt;em&gt;Thought :&lt;/em&gt; interm&#233;diaires,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;les &lt;em&gt;Action :&lt;/em&gt; et &lt;em&gt;Action Input :&lt;/em&gt;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;les &lt;em&gt;Observation :&lt;/em&gt;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;les &lt;em&gt;Answer :&lt;/em&gt; finales.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ce flux est &lt;strong&gt;intentionnellement non structur&#233;&lt;/strong&gt;, car :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;il refl&#232;te exactement ce que le LLM produit,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;il permet d'afficher la r&#233;flexion pas &#224; pas,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;il &#233;vite d'imposer un format unique de parsing pendant le streaming.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Le moteur ne structure pas le flux, car cela casserait la transparence et la flexibilit&#233; du workflow.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;3. Pourquoi le client doit reconstruire les messages ReAct&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Comme le flux est brut, c'est &lt;strong&gt;l'application cliente&lt;/strong&gt; qui doit :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;d&#233;tecter les segments Thought / Action / Observation / Answer,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;les afficher proprement,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&#233;ventuellement les agr&#233;ger ou les filtrer,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ou les transformer en messages de chat.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pour une application de chatbot fond&#233;e sur StreamLit, nous avons d&#233;velopp&#233; &lt;strong&gt;StreamlitChatTracer&lt;/strong&gt; qui a l'avantage de produire en streaming un flux d&#233;cor&#233; (police, couleur etc.).&lt;/p&gt;
&lt;p&gt;LlamaIndex fournit des helpers comme :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;LlamaTrace&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;OpenInference instrumentation&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ces outils :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&#233;coutent les &#233;v&#233;nements &lt;code&gt;AgentStream&lt;/code&gt;, &lt;code&gt;ToolCall&lt;/code&gt;, &lt;code&gt;ToolCallResult&lt;/code&gt;, etc.,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;reconstruisent une vue structur&#233;e du raisonnement,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;permettent une visualisation claire dans le client.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;La reconstruction c&#244;t&#233; client est volontaire : elle permet d'adapter l'affichage au contexte (UI, logs, monitoring, etc.).&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;4. Pourquoi cette s&#233;paration est n&#233;cessaire&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;A. Le LLM produit du texte libre &#8594; pas structur&#233;&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;M&#234;me si ReAct impose un format, le LLM reste libre dans sa g&#233;n&#233;ration.&lt;br /&gt;
Le parser ne peut fonctionner qu'une fois la sortie compl&#232;te.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;B. Le streaming impose de ne pas parser pr&#233;matur&#233;ment&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Un parser ReAct ne peut pas fonctionner sur :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;un Thought incomplet,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un Action Input partiellement g&#233;n&#233;r&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un Answer tronqu&#233;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;C. Le workflow doit rester g&#233;n&#233;rique&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Le moteur ReAct doit :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;fonctionner avec n'importe quel LLM,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ne pas d&#233;pendre d'un format strict,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;permettre des outils de tracing externes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;D. Le client peut choisir son mode de visualisation&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Certains veulent :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;tout afficher (Thoughts inclus),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;masquer les Thoughts,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;afficher uniquement les Tool Calls,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ou ne montrer que la r&#233;ponse finale.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Impossible de satisfaire tous les cas dans le moteur lui-m&#234;me.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;La diff&#233;rence est &lt;strong&gt;n&#233;cessaire&lt;/strong&gt; car :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActOutputParser&lt;/strong&gt; est un outil &lt;em&gt;post-hoc&lt;/em&gt; pour analyser une sortie compl&#232;te.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActEngine&lt;/strong&gt; doit fournir un flux brut pour permettre le streaming et la transparence.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Le client&lt;/strong&gt; doit reconstruire les messages ReAct selon ses besoins (UI, logs, monitoring).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cette architecture garantit :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;flexibilit&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;transparence,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;compatibilit&#233; avec tous les LLM,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;et contr&#244;le total c&#244;t&#233; application.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>ReActEngine, l'IA qui raisonne, s'adapte et comprend votre r&#233;alit&#233; m&#233;tier</title>
		<link>https://ia.dnc.global/ReActEngine-l-IA-qui-raisonne-s-adapte-et-comprend-votre-realite-metier.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/ReActEngine-l-IA-qui-raisonne-s-adapte-et-comprend-votre-realite-metier.html</guid>
		<dc:date>2026-04-11T16:33:39Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Fond&#233; sur ReAct (Raisoning and Acting) ReActEngine appartient &#224; la nouvelle g&#233;n&#233;ration d'agents intelligents capables de raisonner et d'interagir avec vos outils m&#233;tier en s'appuyant sur les donn&#233;es de votre entreprise en temps r&#233;el ainsi que sur votre documentation. Avec le standard MCP (Model Context Protocol), il se connecte naturellement &#224; votre &#233;cosyst&#232;me industriel et devient un v&#233;ritable copilote cognitif pour l'Industrie 4.0 et au&#8209;del&#224;. Gr&#226;ce au RAG (Research Augmented Generation), il exploite la (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-rubrique5-.html" rel="directory"&gt;IA&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://ia.dnc.global/local/cache-vignettes/L150xH103/arton70-d6fe3.png?1776303650' width='150' height='103' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;Fond&#233; sur ReAct (Raisoning and Acting) ReActEngine appartient &#224; la nouvelle g&#233;n&#233;ration d'agents intelligents capables de raisonner et d'interagir avec vos outils m&#233;tier en s'appuyant sur les donn&#233;es de votre entreprise en temps r&#233;el ainsi que sur votre documentation.&lt;br class='autobr' /&gt;
Avec le standard MCP (Model Context Protocol), il se connecte naturellement &#224; votre &#233;cosyst&#232;me industriel et devient un v&#233;ritable copilote cognitif pour l'Industrie 4.0 et au&#8209;del&#224;.&lt;br class='autobr' /&gt;
Gr&#226;ce au RAG (Research Augmented Generation), il exploite la documentation interne de l'entreprise pour &#233;clairer son raisonnement et illustrer ses r&#233;ponses.&lt;/p&gt;
&lt;p&gt;ReActEngine est d&#233;velopp&#233; en France et utilise un mod&#232;le de langage de MistralAI. Cocorico !&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h2&gt;&lt;strong&gt;Une vision fine, pr&#233;dictive et explicable de vos processus&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;ReActEngine combine trois piliers compl&#233;mentaires :&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;1. ReAct &#8212; Raisonnement structur&#233;&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;L'agent ne se contente pas de r&#233;pondre :&lt;br /&gt;
il &lt;strong&gt;analyse&lt;/strong&gt;, &lt;strong&gt;d&#233;compose&lt;/strong&gt;, &lt;strong&gt;v&#233;rifie&lt;/strong&gt;, puis &lt;strong&gt;agit&lt;/strong&gt;.&lt;br /&gt;
Cette approche multi&#8209;&#233;tapes permet :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;une compr&#233;hension plus fine des intentions,&lt;/li&gt;
&lt;li&gt;des r&#233;ponses explicites et argument&#233;es,&lt;/li&gt;
&lt;li&gt;une meilleure gestion des situations complexes ou ambigu&#235;s.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;2. RAG &#8212; Votre documentation comme socle de v&#233;rit&#233;&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Gr&#226;ce &#224; un module RAG int&#233;gr&#233;, ReActEngine s'appuie sur :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;vos historiques,&lt;/li&gt;
&lt;li&gt;vos proc&#233;dures,&lt;/li&gt;
&lt;li&gt;vos r&#233;f&#233;rentiels techniques,&lt;/li&gt;
&lt;li&gt;vos routines m&#233;tier.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il devient un assistant qui &lt;strong&gt;parle votre langage&lt;/strong&gt;, &lt;strong&gt;comprend vos r&#232;gles&lt;/strong&gt; et &lt;strong&gt;s'appuie sur votre corpus documentaire&lt;/strong&gt; .
Le principe du RAG est de traiter les documents d'une entit&#233;. Il faut pouvoir saisir facilement toute la documentation et surtout tenir &#224; jour cette documentation de fa&#231;on continue. C'est le r&#244;le du &lt;a href='https://ia.dnc.global/Ingestion-le-RAG-Manager.html' class='spip_in'&gt;RAG Manager&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;3. MCP &#8212; Vos donn&#233;es temps r&#233;el, sans int&#233;gration complexe&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;MCP agit comme un &lt;strong&gt;USB&#8209;C de l'IA&lt;/strong&gt; :&lt;br /&gt;
une interface universelle pour connecter l'agent &#224; vos syst&#232;mes (ERP, CRM, API internes, capteurs, machines&#8230;).&lt;/p&gt;
&lt;p&gt;Il apporte :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;des donn&#233;es toujours &#224; jour,&lt;/li&gt;
&lt;li&gt;une r&#233;duction massive des co&#251;ts d'int&#233;gration,&lt;/li&gt;
&lt;li&gt;une meilleure s&#233;curit&#233;,&lt;/li&gt;
&lt;li&gt;une interop&#233;rabilit&#233; imm&#233;diate.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;strong&gt;Pens&#233; pour l'Industrie 4.0&#8230; et pr&#234;t pour l'Industrie 5.0&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Dans les environnements industriels, ReActEngine devient un &lt;strong&gt;assistant op&#233;rationnel&lt;/strong&gt; capable de :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;suivre l'&#233;volution des donn&#233;es en direct,&lt;/li&gt;
&lt;li&gt;anticiper les d&#233;rives,&lt;/li&gt;
&lt;li&gt;expliquer ses analyse et justifier ses propositions,&lt;/li&gt;
&lt;li&gt;demander l'expertise de l'humain quand n&#233;cessaire,
sans jamais inventer ou halluciner.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Avec l'arriv&#233;e de l'Industrie 5.0, il s'int&#232;gre naturellement aux &lt;strong&gt;jumeaux num&#233;riques&lt;/strong&gt;, offrant une vision :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;plus fine,&lt;/li&gt;
&lt;li&gt;plus pr&#233;dictive,&lt;/li&gt;
&lt;li&gt;plus explicable&lt;br /&gt;
des processus industriels.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;strong&gt;Une architecture modulaire, con&#231;ue pour vos m&#233;tiers&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;ReActEngine s'appuie sur trois ToolKits compl&#233;mentaires :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;GeneralToolKit&lt;/strong&gt;&lt;br /&gt;
Les outils g&#233;n&#233;riques indispensables &#224; tout raisonnement.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ThemeToolKit&lt;/strong&gt;&lt;br /&gt;
Les outils sp&#233;cifiques &#224; votre domaine m&#233;tier, incluant un outil RAG d&#233;di&#233;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ToolKit temps r&#233;el (MCP)&lt;/strong&gt;&lt;br /&gt;
Les connecteurs vers vos donn&#233;es op&#233;rationnelles, capteurs, API et syst&#232;mes internes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cette modularit&#233; garantit une adaptation rapide &#224; chaque contexte, sans r&#233;&#233;criture de l'agent.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Les b&#233;n&#233;fices imm&#233;diats&lt;/strong&gt;&lt;/h2&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;D&#233;cisions plus rapides et mieux inform&#233;es&lt;/strong&gt;&lt;br /&gt;
Gr&#226;ce &#224; des donn&#233;es actualis&#233;es et un raisonnement expliqu&#233;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Interop&#233;rabilit&#233; native&lt;/strong&gt;&lt;br /&gt;
Via MCP, un standard universel, sans connecteurs maison ni int&#233;grations lourdes, adapt&#233; &#224; l'atelier comme &#224; l'administration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Personnalisation m&#233;tier&lt;/strong&gt;&lt;br /&gt;
Chaque th&#232;me, configur&#233; pour vous, dispose de ses outils, de votre vocabulaire et de votre logique.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;R&#233;duction de la dette technique&lt;/strong&gt;&lt;br /&gt;
Une architecture standardis&#233;e, durable et &#233;volutive.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;S&#233;curit&#233; renforc&#233;e&lt;/strong&gt;&lt;br /&gt;
Contr&#244;les d'acc&#232;s par &lt;a href=&#034;https://oa.dnc.global&#034; class='spip_out' rel='external'&gt;OAuth 2.0 ou OpenID Connect&lt;/a&gt; et gestion des autorisations, y compris pour le RAG et MCP. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;strong&gt;ReActEngine &#8212; L'IA qui comprend votre m&#233;tier et agit avec vous&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Un agent capable de raisonner, d'expliquer, d'interroger vos syst&#232;mes en direct et de s'appuyer sur votre documentation interne.&lt;br /&gt;
Un assistant qui vous accompagne dans la transformation vers une industrie plus r&#233;active, plus pr&#233;dictive et connect&#233;e &#224; l'humain.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pour en savoir plus :&lt;/strong&gt;&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;a href='https://ia.dnc.global/ReAct-et-integration-des-donnees-temps-reel-avec-MCP.html' class='spip_in'&gt;ReAct et int&#233;gration des donn&#233;es temps r&#233;el avec MCP ( Model Context Protocol ) &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href='https://ia.dnc.global/-ReActEngine-v1-.html' class='spip_in'&gt;Pr&#233;sentation technique de ReActEngine Mistral v1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;En d&#233;veloppement : &lt;a href='https://ia.dnc.global/-Architecture-ReAct-first-Neuro-symbolique-.html' class='spip_in'&gt;ReActEngine v2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>ReActEngine v1 : traitement des erreurs</title>
		<link>https://ia.dnc.global/ReActEngine-v1-traitement-des-erreurs.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/ReActEngine-v1-traitement-des-erreurs.html</guid>
		<dc:date>2026-04-11T08:53:07Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Dans un agent de type ReAct, le raisonnement est construit &#233;tape par &#233;tape. Si une &#233;tape &#233;choue, le LLM doit avoir des informations suffisantes pour reprendre le raisonnement, ou sinon risque de s'arr&#234;ter simplement, de fa&#231;on silencieuse. L'enjeu du traitement des erreurs est de toujours fournir au LLM de quoi construire une nouvelle &#233;tape de raisonnement. Dans l'&#233;tat actuel des modules LlamaIndex, trop d'erreurs sont simplement lev&#233;es avec une classe d'exception &#034;pythonique&#034;, en dehors de tout (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Dans un agent de type ReAct, le raisonnement est construit &#233;tape par &#233;tape. Si une &#233;tape &#233;choue, le LLM doit avoir des informations suffisantes pour reprendre le raisonnement, ou sinon risque de s'arr&#234;ter simplement, de fa&#231;on silencieuse.&lt;br class='autobr' /&gt;
L'enjeu du traitement des erreurs est de toujours fournir au LLM de quoi construire une nouvelle &#233;tape de raisonnement.&lt;br class='autobr' /&gt;
Dans l'&#233;tat actuel des modules LlamaIndex, trop d'erreurs sont simplement lev&#233;es avec une classe d'exception &#034;pythonique&#034;, en dehors de tout processus de reprise. C'est un probl&#232;me assez g&#233;n&#233;ral, que l'on retrouve dans les plus grands chatbots, se traduisant alors par un silence, un abandon ou un blocage.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h1&gt;Le traitement des erreurs dans ReActEngine&lt;/h1&gt;
&lt;p&gt;Dans ReActEngine, les erreurs sont trait&#233;es de deux mani&#232;res, &#224; deux niveaux et de fa&#231;on ind&#233;pendante : les &lt;strong&gt;Exceptions&lt;/strong&gt; et les &lt;strong&gt;Thoughts inject&#233;s&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;A - Exceptions&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Pour corriger la sortie ReAct mal form&#233;e avant m&#234;me qu'elle n'entre dans le flux.
Exceptions = correction structurelle.&lt;/p&gt;
&lt;p&gt;Aucune erreur survenant au cours de l'ex&#233;cution de &lt;code&gt;take_step()&lt;/code&gt; ( ce qui inclut de nombreux modules tels que les ToolBox, MCP etc. ) ne doit lever une exception de classe g&#233;n&#233;rale. Seules deux classes d'exceptions peuvent &#234;tre utilis&#233;es, et doivent &#234;tre trait&#233;es dans ce module :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;strong&gt;RetryException&lt;/strong&gt;
Indique qu'une erreur r&#233;cup&#233;rable s'est produite ( une r&#233;ponse du LLM incompl&#232;te ou mal form&#233;e, une erreur d'outil etc. ). La m&#234;me &#233;tape ReAct doit &#234;tre r&#233;-essay&#233;e, &#224; charge du LLM de trouver un contournement en se basant sur les indications du message d'erreur.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ForceFinalizeException&lt;/strong&gt;
Indique qu'une erreur non r&#233;cup&#233;rable s'est produite ( un &#233;tat ReAct invalide, une erreur d'outil sans contournement possible etc. ) et que le LLM doit produire directement une r&#233;ponse finale.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Exemple d'exception lev&#233;e par un outil : &lt;/p&gt;&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; date_str_s.&lt;span style=&#034;color: black;&#034;&gt;isdigit&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; RetryException&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Invalid input: this function expects a readable date, not a timestamp, retry with ISO 8601 formats (`YYYY-MM-DD`, `YYYY-MM-DDTHH:MM:SS`).&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/c5b1c543d8161e21061665f4cec6bfc4.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;Exemples de situations r&#233;cup&#233;rables :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Action Input manquant&lt;/li&gt;
&lt;li&gt;Thought sans Action&lt;/li&gt;
&lt;li&gt;JSON invalide&lt;/li&gt;
&lt;li&gt;protocole ReAct viol&#233;&lt;/li&gt;
&lt;li&gt;output tronqu&#233; en streaming&lt;/li&gt;
&lt;li&gt;outil mal appell&#233; ou mal utilis&#233;
Dans ces cas, le LLM re&#231;oit les informations n&#233;cessaires pour r&#233;g&#233;n&#233;rer une &#233;tape ReAct correcte.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;B - Thought inject&#233;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;Pour corriger le raisonnement, pas la forme. Thought = correction cognitive&lt;/p&gt;
&lt;p&gt;Exemple :&lt;/p&gt;&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; block.&lt;span style=&#034;color: #008000;&#034;&gt;type&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;ReActType.&lt;span style=&#034;color: black;&#034;&gt;OBSERVATION&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; ReActType.&lt;span style=&#034;color: black;&#034;&gt;FINAL_ANSWER&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; block.&lt;span style=&#034;color: black;&#034;&gt;content&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;strip&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;: &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;#x&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;yield&lt;/span&gt; ReActBlock&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;type&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;ReActType.&lt;span style=&#034;color: black;&#034;&gt;THOUGHT&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; content&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Je constate que je n'ai obtenu aucune r&#233;ponse. Peut-&#234;tre devrais-je v&#233;rifier les param&#232;tres ou reformuler ma demande.&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;continue&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/c3cc449d92c4344d1d025200503762ee.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Cas d'usage :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;bouclage sur un outil en erreur&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;observation vide ( pertinente ou r&#233;sultant d'une erreur )&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;it&#233;rations excessives&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;action r&#233;p&#233;t&#233;e&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;mod&#232;le qui &#034;tourne en rond&#034;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Dans ces cas, on veut reprendre le flux, pas relancer le LLM.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;Diagramme du traitement des erreurs&lt;/h2&gt;
&lt;p&gt;Les deux modes influencent le raisonnement, mais &#224; des niveaux diff&#233;rents du pipeline.
La diff&#233;rence entre ces deux modes et leur ind&#233;pendance appara&#238;t clairement dans ce diagramme :&lt;/p&gt;
&lt;dl class='spip_document_35 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/reactagent_workflow-2026-04-11-081323.png' class=&#034;mediabox&#034; title=&#034;ReActEngine : Traitement des erreurs&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH361/reactagent_workflow-2026-04-11-081323-998b5.png?1776303652' width='500' height='361' alt=&#034;PNG - 1.5&#160;Mo&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-35 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;ReActEngine : Traitement des erreurs &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;p&gt;Les exceptions RetryException et ForceFinalizeException agissent entre 3 et 7 ( interne au ReActAgent ), l'insertion des Thoughts entre 8 et 12 ( le niveau d(orchestration par le Finalizer).&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div &lt;div class='rss_ps'&gt;&lt;p&gt;##Est-ce suffisant ?&lt;br class='autobr' /&gt;
S'agissant de la boucle ReAct (les exceptions), le traitement ne peut &#234;tre am&#233;lior&#233; sans remonter explicitement dans un arbre de raisonnement (Backtracking) en cas d'erreur.&lt;br class='autobr' /&gt;
Il s'agit de quitter ou corriger la branche courante :
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; le moteur revient &#224; un &#233;tat ant&#233;rieur du raisonnement,
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; demande au mod&#232;le de r&#233;essayer une nouvelle &#233;tape de contournement.&lt;/p&gt;
&lt;p&gt;C'est d&#233;j&#224; fait partiellement via RetryException, mais ce n'est pas encore du vrai backtracking, car :
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; on n'a pas un historique structur&#233; - pas d'&#034;arborescence&#034; ni de &#034;branches&#034; - des &#233;tats (stack des ReasoningSteps)
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; on ne revient pas &#224; un &#233;tat ant&#233;rieur du raisonnement,
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; on ne supprime pas la branche fautive,
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; on ne modifie pas le contexte du mod&#232;le.&lt;/p&gt;
&lt;p&gt;*&#224; suivre...*&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>ReActEngine v1 : Modules et traitements</title>
		<link>https://ia.dnc.global/ReActEngine-v1-Modules-et-traitements.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/ReActEngine-v1-Modules-et-traitements.html</guid>
		<dc:date>2026-04-09T08:23:12Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;ReActEngine Mistral v1 est un moteur agentique modulaire, contr&#244;lable et extensible, combinant RAG (Research Augmented Generation), outils personnalis&#233;s, s&#233;lection dynamique d'outils dont MCP (Model Context Protocol) et g&#233;n&#233;ration orchestr&#233;e. Il est con&#231;u pour les environnements multi-th&#232;mes, multi-sources et n&#233;cessitant une auditabilit&#233; stricte du raisonnement et des actions. &lt;br class='autobr' /&gt; Destin&#233;e &#224; un public expert, voici une description de l'agent **ReActEngine Mistral v104** fond&#233; sur (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;img class='spip_logo spip_logo_right spip_logos' alt=&#034;&#034; style='float:right' src='https://ia.dnc.global/local/cache-vignettes/L150xH103/arton68-d9178.png?1776303652' width='150' height='103' /&gt;
		&lt;div class='rss_chapo'&gt;&lt;p&gt;ReActEngine Mistral v1 est un moteur agentique modulaire, contr&#244;lable et extensible, combinant RAG (Research Augmented Generation), outils personnalis&#233;s, s&#233;lection dynamique d'outils dont MCP (Model Context Protocol) et g&#233;n&#233;ration orchestr&#233;e.&lt;br class='autobr' /&gt;
Il est con&#231;u pour les environnements multi-th&#232;mes, multi-sources et n&#233;cessitant une auditabilit&#233; stricte du raisonnement et des actions.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;p&gt;Destin&#233;e &#224; un public expert, voici une description de l'agent &lt;strong&gt;ReActEngine Mistral v104&lt;/strong&gt; fond&#233; sur &lt;code&gt;llama_index.core.agent.workflow.ReActAgent&lt;/code&gt;, int&#233;grant Finalizer, ToolRouter, RAG, outils personnalis&#233;s et orchestration.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;ReActEngine Mistral v104 &#8212; Description technique&lt;/strong&gt;&lt;/h2&gt;
&lt;h1&gt;1. Nature de l'agent&lt;/h1&gt;
&lt;p&gt;L'agent &lt;strong&gt;Mistral ReAct v104&lt;/strong&gt; est un moteur agentique bas&#233; sur le paradigme &lt;strong&gt;ReAct (Reasoning + Acting)&lt;/strong&gt;.&lt;br /&gt;
Il combine :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;un &lt;strong&gt;LLM Mistral&lt;/strong&gt; (via API ou local),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un &lt;strong&gt;orchestrateur d'outils&lt;/strong&gt; dont MCP,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un &lt;strong&gt;Finalizer&lt;/strong&gt; pour la g&#233;n&#233;ration contr&#244;l&#233;e,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un &lt;strong&gt;ToolRouter&lt;/strong&gt; pour la s&#233;lection dynamique d'outils,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;un &lt;strong&gt;RAG&lt;/strong&gt; (Research Augmented Generation) modulaire bas&#233; sur l'agent de recherche &lt;a href='https://ia.dnc.global/Chat-Engine-Mistral.html' class='spip_in'&gt;Chat Engine Mistral&lt;/a&gt; utilis&#233; par notre ChatBot simple.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il s'appuie sur la classe &lt;strong&gt;&lt;a href='https://ia.dnc.global/Comment-ReActAgent-s-insere-dans-le-Workflow-LlamaIndex.html' class='spip_in'&gt;ReActAgent(Workflow)&lt;/a&gt;&lt;/strong&gt; plut&#244;t que sur les agents pr&#233;construits, afin de garantir :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;un contr&#244;le fin du cycle ReAct,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;une meilleure auditabilit&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;une int&#233;gration propre des outils personnalis&#233;s,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;une compatibilit&#233; avec les pipelines agentiques complexes.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Constatant que les &lt;a href='https://ia.dnc.global/ReActEngine-v1-traitement-des-erreurs.html' class='spip_in'&gt;erreurs dans la boucle ReAct&lt;/a&gt; non intercept&#233;es ou mal trait&#233;es aboutissaient sur un arr&#234;t intempestif et silencieux du raisonnement, &lt;strong&gt;un principe est pos&#233; : dans la boucle ReAct, seules deux exceptions peuvent ( et doivent ) &#234;tre lev&#233;es : RetryException et ForceFinalizeException. Le message d'erreur doit &#234;tre explicite pour permettre au raisonnement de poursuivre ou de retourner proprement vers l'utilisateur&lt;/strong&gt;.
Ceci a motiv&#233; une part des modifications au code de Llamaindex.&lt;/p&gt;
&lt;p&gt;Avec le m&#234;me objectif - &#233;viter les arr&#234;ts du raisonnement - deux autres modifications portent sur la g&#233;n&#233;ration et le traitement de &lt;strong&gt;question pos&#233;e &#224; l'utilisateur&lt;/strong&gt; ainsi que le &lt;strong&gt;recours au RAG&lt;/strong&gt; pour y trouver des informations susceptibles de guider le raisonnement.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Points cl&#233;s de la version v104&lt;/strong&gt;&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Int&#233;gration du &lt;strong&gt;Finalizer&lt;/strong&gt; (contr&#244;le de la r&#233;ponse finale).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Int&#233;gration du &lt;strong&gt;ToolRouter&lt;/strong&gt; (s&#233;lection dynamique des outils).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Utilisation de &lt;code&gt;ReActAgent(Workflow)&lt;/code&gt; plut&#244;t que l'agent pr&#233;construit, afin d'atteindre le c&#339;ur de la boucle ReAct et y apporter des am&#233;liorations .&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Acc&#232;s du LLM au RAG avec l'outil &lt;code&gt;RagTool&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Acc&#232;s du LLM aux donn&#233;es temps r&#233;el avec MCP.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Architecture stateless c&#244;t&#233; agent, stateful c&#244;t&#233; application.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Gestion centralis&#233;e des erreurs assurant la &lt;strong&gt;continuit&#233; du raisonnement&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;2. Architecture g&#233;n&#233;rale&lt;/h1&gt;
&lt;h2&gt;2.1. Diagramme des &#233;changes&lt;/h2&gt;
&lt;dl class='spip_document_28 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/reactengine_diagram_20260408.png' class=&#034;mediabox&#034; title=&#034;ReActEngine v1 diagramme des &#233;changes&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH242/reactengine_diagram_20260408-0e31b.png?1776303653' width='500' height='242' alt=&#034;PNG - 774.8&#160;ko&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-28 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;ReActEngine v1 diagramme des &#233;changes &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;p&gt;Les modules de la partie gauche (ReActEngine, ToolRouter, ReActFinalizer, ReActStreamParser) ont &#233;t&#233; d&#233;velopp&#233;s sp&#233;cialement pour atteindre les objectifs du ReActEngine v1, tandis que la partie droite comprend les modules du ReActAgent(Workflow) de LlamaIndex avec quelques adaptations. Le LLM est une API de MistralAI.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Conseils : Cliquez sur le diagramme pour le zoomer. Ouvrez le diagramme dans une autre fen&#234;tre pour mieux suivre la suite.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;2.2. Vision globale du flux&lt;/h2&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Utilisateur &#8594; ReActEngine&lt;/strong&gt; : prompt.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActEngine &#8594; ToolRouter&lt;/strong&gt; : s&#233;lection d'outils.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActEngine &#8594; ReActAgent&lt;/strong&gt; : initialisation du pipeline.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Formatter &#8594; LLM&lt;/strong&gt; : message format&#233;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;LLM &#8594; StreamParser&lt;/strong&gt; : tokens bruts &#8594; blocs ReAct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Parser &#8594; Agent&lt;/strong&gt; : StepResult.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Workflow&lt;/strong&gt; : d&#233;cide de la suite (outil, raisonnement, final).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Finalizer&lt;/strong&gt; : rebouclage sur erreur ou r&#233;ponse finale.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ReActEngine &#8594; Utilisateur&lt;/strong&gt; : streaming de la r&#233;ponse.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A partir d'ici, nous pouvons distinguer :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;La &lt;strong&gt;boucle ReAct&lt;/strong&gt; reposant sur les modules LlamaIndex : ReActAgent, BaseWorkflowAgent, ReActWorkflow, ReActOutputParser. Seule la boucle ReAct &#233;change avec le LLM.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'&lt;strong&gt;Orchestrateur&lt;/strong&gt; compos&#233; des modules de haut-niveau : ReActEngine, ToolRouter, &lt;a href='https://ia.dnc.global/Architecture-ReAct-Finalizer-et-StreamParser.html' class='spip_in'&gt;ReActFinalizer, ReActStreamParser&lt;/a&gt;. ReActAgent est le seul lien avec ce niveau applicatif.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2.3. Boucle ReAct&lt;/h2&gt;
&lt;p&gt;L'agent suit la logique d&#233;crite dans &lt;em&gt;Synergizing Reasoning and Acting in Language Models&lt;/em&gt; :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reasoning&lt;/strong&gt; : le LLM produit une intention ou un plan.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Acting&lt;/strong&gt; : l'agent appelle un outil.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Observation&lt;/strong&gt; : l'outil renvoie un r&#233;sultat.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reasoning&lt;/strong&gt; : le LLM int&#232;gre l'observation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Final Answer&lt;/strong&gt; : produit par le Finalizer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Avec LlamaIndex ReActAgent bas&#233; sur Workflow, la boucle ReAct est orchestr&#233;e par r&#233;p&#233;tition de la &lt;strong&gt;fonction take_step()&lt;/strong&gt;. Toute &lt;strong&gt;action&lt;/strong&gt; est synonyme d'&lt;strong&gt;appel &#224; un outil&lt;/strong&gt;. Il est mis fin &#224; la boucle lorsqu'une &lt;strong&gt;r&#233;ponse finale&lt;/strong&gt; est d&#233;tect&#233;e .&lt;/p&gt;
&lt;dl class='spip_document_30 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/react_boucle_diagram-2026-04-10-074714.png' class=&#034;mediabox&#034; title=&#034;La boucle ReAct&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH379/react_boucle_diagram-2026-04-10-074714-9a581.png?1776303655' width='500' height='379' alt=&#034;PNG - 613&#160;ko&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-30 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;La boucle ReAct &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;p&gt;En r&#233;sum&#233; :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Le workflow ne fait qu'appeler en boucle la m&#233;thode take_step.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ReActAgent construit chaque &#233;tape en appelant le LLM.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le parser transforme les deltas en blocs ReAct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le finalizer d&#233;cide si l'agent doit continuer ou s'arr&#234;ter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le workflow relance l'&#233;tape tant que n&#233;cessaire.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;ReActAgent (remani&#233;)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; message format&#233; (prompt + contexte + outils).&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
Impl&#233;mente la logique ReAct :&lt;br /&gt;
Thought &#8594; Action &#8594; Observation &#8594; Thought &#8594; &#8230;&lt;br /&gt;
D&#233;cide quand appeler un outil.
Produit un &lt;em&gt;StepResult&lt;/em&gt; &#224; chaque it&#233;ration.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; StepResult (structure contenant Thought/Action/Observation).&lt;/p&gt;
&lt;p&gt;Ce module est au centre du protocole ReAct. Il fournit l'infrastructure n&#233;cessaire pour traiter :
la construction des &#233;tapes de raisonnement, les appels au LLM, le parsing structur&#233; des r&#233;ponses du LLM, le d&#233;clenchement d'outils, la production de la r&#233;ponse finale.&lt;/p&gt;
&lt;p&gt;Le ReActAgent ne traite qu'une &#233;tape &#224; la fois. Il est appel&#233;, d'&#233;tape en &#233;tape, par la m&#233;thode run_agent_step du &lt;a href='https://ia.dnc.global/Comment-ReActAgent-s-insere-dans-le-Workflow-LlamaIndex.html' class='spip_in'&gt;Workflow&lt;/a&gt;.&lt;/p&gt;
&lt;h4&gt;La m&#233;thode take_step()&lt;/h4&gt;
&lt;p&gt;Au c&#339;ur de la boucle ReAct, cette m&#233;thode traite une seule &#233;tape de raisonnement :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Formater l'entr&#233;e du LLM &#224; l'aide du template ReAct.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Appeler le LLM (en mode streaming ou non).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Parser la sortie du mod&#232;le en un ReasoningStep structur&#233;.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;G&#233;rer les erreurs de parsing ou les &#233;tats ReAct invalides.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Puis, selon le cas :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;retourner une r&#233;ponse finale,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;d&#233;clencher un appel d'outil,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ou &lt;em&gt;demander au LLM de r&#233;essayer&lt;/em&gt; ou de finaliser.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Les principales modifications portent sur la gestion des sorties LLM mal form&#233;es ou incompl&#232;tes, ainsi que sur le traitement des exceptions :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;normalisation du format de sortie du LLM, contribuant &#224; rendre l'agent agnostique en ce qui concerne les LLMs dont les formats sont peu normalis&#233;s.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;relance de la boucle lorsque le parseur d&#233;tecte une sortie ReAct incompl&#232;te, mal form&#233;e ou autrement invalide, mais pouvant &#234;tre corrig&#233;e par le mod&#232;le.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;traitement de deux exceptions, :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RetryException&lt;/code&gt; &#8594; la sortie est incompl&#232;te ou tronqu&#233;e ; le LLM doit
r&#233;essayer en se fondant sur le message d'erreur. Cela couvre aussi les erreurs des outils.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ForceFinalizeException&lt;/code&gt; &#8594; le mod&#232;le a produit un &#233;tat ReAct invalide
(ex. : Thought sans Action ni Answer) ; le prochain appel LLM doit produire
uniquement une r&#233;ponse finale. &lt;strong&gt;Ces exceptions sont les seules autoris&#233;es au sein de la boucle afin d'&#233;viter les arr&#234;ts silencieux de l'agent&lt;/strong&gt;. Toutes les exceptions d'une autre classe lev&#233;es au sein du code sont intercept&#233;es et ramen&#233;es &#224; l'une de ces deux exceptions.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;La m&#233;thode handle_tool_call_result()&lt;/h4&gt;
&lt;p&gt;Cette m&#233;thode traite les r&#233;sultats des appels d'outils :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;r&#233;cup&#232;re l'historique courant de raisonnement (variable d'&#233;tat ctx),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;inspecte chaque r&#233;sultat d'outil,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;distingue les erreurs r&#233;elles des contenus vides l&#233;gitimes,&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;normalise le contenu observ&#233;,&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ajoute une &#233;tape d'observation au raisonnement,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;g&#232;re les cas particuliers (ask_user, return_direct),&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;met &#224; jour l'&#233;tat persistant du raisonnement dans le contexte (variable d'&#233;tat ctx).
Les principales modifications incluent :&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la distinction entre un retour d'outil l&#233;gitimement vide et une erreur de l'outil.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la normalisation du retour d'outil (le contenu observ&#233;), contribuant &#224; l'adaptation aux diff&#233;rents LLMs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;une d&#233;tection d'erreurs garantissant que les outils signalent explicitement leurs &#233;checs en levant l'une des exception RetryException ou ForceFinalizeException afin d'&#233;viter un arr&#234;t intempestif du raisonnement.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la gestion d'un &lt;strong&gt;outil AskUserTool&lt;/strong&gt; ( cr&#233;&#233; dans la GeneralToolBox ) permettant au mod&#232;le de poser une question &#224; l'utilisateur, puis la transformation de sa r&#233;ponse en Observation ReAct et la relance de la boucle ReAct via take_step().&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;BaseWorkflowAgent (modifi&#233;)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; StepResult ou message interm&#233;diaire.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
G&#232;re la logique g&#233;n&#233;rique d'un agent (&#233;tat, transitions, erreurs).
Coordonne les appels entre Workflow, Formatter, Parser.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; instructions pour la prochaine &#233;tape du workflow.&lt;/p&gt;
&lt;p&gt;La principale modification porte sur la gestion de la pause en attente d'une r&#233;ponse de l'utilisateur (outil AskUser).&lt;/p&gt;
&lt;h3&gt;ReActWorkflow&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; StepResult + contexte d'ex&#233;cution.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
Orchestration du cycle ReAct.
D&#233;termine si l'agent doit :&lt;br /&gt;
continuer &#224; raisonner,&lt;br /&gt;
appeler un outil,&lt;br /&gt;
ou produire la r&#233;ponse finale.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; nouvelle &#233;tape &#224; ex&#233;cuter (run_step).&lt;/p&gt;
&lt;h3&gt;ReActChatFormatter&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; prompt utilisateur + &#233;tat du workflow.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
Formate le message dans le style attendu par le LLM (system + user + tool instructions).
Injecte les outils dans le prompt si n&#233;cessaire.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; &lt;em&gt;message format&#233;&lt;/em&gt; envoy&#233; au LLM.&lt;/p&gt;
&lt;h3&gt;ReActOutputParser (modifi&#233;)&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; sortie brute du LLM. &lt;strong&gt;Traitement :&lt;/strong&gt;
Analyse la r&#233;ponse du LLM.
Extrait Thought / Action / Observation / FinalAnswer.
D&#233;tecte les erreurs de format.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; StepResult structur&#233;.&lt;/p&gt;
&lt;p&gt;Les principales modifications portent sur une d&#233;tection et une gestion correcte des erreurs en levant RetryException ou ForceFinalizeException afin d'&#233;viter les arr&#234;ts intempestifs du LLM.&lt;/p&gt;
&lt;h3&gt;Mod&#232;le LLM&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; message format&#233; (prompt complet).&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
G&#233;n&#233;ration token-par-token.
Produit du texte brut sans structure interne explicite.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; tokens bruts &#8594; envoy&#233;s au StreamParser.&lt;/p&gt;
&lt;p&gt;Il faut noter que, si de nombreuses adaptations visent &#224; rendre notre ReActAgent agnostique vis-&#224;-vis des LLMs, notamment en normalisant les formats des requ&#234;tes et des r&#233;ponses, cela n'est pas encore finalis&#233; dans l'&#233;tat actuel du d&#233;veloppement.&lt;/p&gt;
&lt;h3&gt;Tool&lt;/h3&gt;
&lt;p&gt;L'agent combine trois familles d'outils :&lt;/p&gt;
&lt;h4&gt;A. RAG (QueryEngineTool)&lt;/h4&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Bas&#233; sur &lt;code&gt;chat_engine_mistral_v1.3.x&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Utilise les index cr&#233;&#233;s par &lt;strong&gt;RAG Manager&lt;/strong&gt; ou &lt;strong&gt;IngestCmd&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Permet un RAG coh&#233;rent, multith&#232;me, multilingue.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Exposer un outil RAG &#224; la boucle ReAct permet au LLM d'acc&#233;der &#224; des descriptions syst&#233;miques, des routines de raisonnement, des sp&#233;cifications etc., tout documents normatifs permettant de soutenir le raisonnement et de le r&#233;-orienter en cas d'impasse.&lt;/p&gt;
&lt;h4&gt;B. Outils personnalis&#233;s (FunctionTools)&lt;/h4&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Fournissent des donn&#233;es &lt;strong&gt;temps r&#233;el&lt;/strong&gt; (par exemple issues de &lt;strong&gt;&lt;a href=&#034;https://thewiw.com&#034; class='spip_out' rel='external'&gt;WhatisWhat&lt;/a&gt;&lt;/strong&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Les donn&#233;es sont inject&#233;es via &lt;strong&gt;MCP&lt;/strong&gt;. Voir : &lt;a href='https://ia.dnc.global/ReAct-et-integration-des-donnees-temps-reel-avec-MCP.html' class='spip_in'&gt;ReAct et int&#233;gration des donn&#233;es temps r&#233;el avec MCP ( Model Context Protocol ) &lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Exemples : m&#233;t&#233;o, &#233;tat d'un syst&#232;me, donn&#233;es m&#233;tier, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Voir &#233;galement : &lt;a href='https://ia.dnc.global/Classe-ChatEngine-version-1-5-x-pour-ChattyBot.html' class='spip_in'&gt;RAG : Chat Engine ReAct avec outils&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;C. Outils g&#233;n&#233;ralistes&lt;/h4&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Calculs : arithm&#233;tique, statistique&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Manipulation de texte&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Utilitaires divers&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;strong&gt;2.3. Orchestrateur&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;De ce point de vue, on peut consid&#233;rer le ReActEngine d&#233;crit pr&#233;c&#233;demment comme une bo&#238;te noire (dont on repr&#233;sente tout de m&#234;me l'essentiel pour une meilleure compr&#233;hension) anim&#233;e par l'Orchestrateur.&lt;/p&gt;
&lt;dl class='spip_document_32 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/reactengine_diagram_mermaid-2026-04-10-125932.png' class=&#034;mediabox&#034; title=&#034;Modules de haut niveau, autour de l'agent ReAct&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH357/reactengine_diagram_mermaid-2026-04-10-125932-d4abe.png?1776303656' width='500' height='357' alt=&#034;PNG - 638.7&#160;ko&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-32 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;Modules de haut niveau, autour de l'agent ReAct &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;h3&gt;User&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; intention humaine, question, commande.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt; aucun &#8212; c'est la source du prompt.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; &lt;em&gt;prompt utilisateur&lt;/em&gt; envoy&#233; au ReActEngine.&lt;/p&gt;
&lt;h3&gt;ToolRouter&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; prompt brut.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
Analyse s&#233;mantique du prompt.
S&#233;lectionne les outils pertinents (toolbag).&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; liste d'outils pertinents &#8594; renvoy&#233;e au ReActEngine.&lt;/p&gt;
&lt;h3&gt;ReActEngine&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; prompt utilisateur.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
D&#233;termine si le prompt n&#233;cessite des outils.
Appelle le &lt;strong&gt;ToolRouter&lt;/strong&gt; pour identifier les outils pertinents.
Initialise un agent ReAct complet (Finalizer, Workflow, Formatter, Parser&#8230;).
Lance la boucle de streaming (token-par-token).&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; flux de tokens structur&#233;s (Thought / Action / Observation / FinalAnswer).&lt;/p&gt;
&lt;h3&gt;ReActStreamParser&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; tokens bruts provenant du LLM. &lt;strong&gt;Traitement :&lt;/strong&gt;
Reconstitue les blocs ReAct (Thought, Action, Observation&#8230;).
Filtre les artefacts, nettoie les tokens.
&#201;met des fragments de r&#233;ponse via un g&#233;n&#233;rateur asynchrone.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; tokens nettoy&#233;s + blocs ReAct structur&#233;s.&lt;/p&gt;
&lt;h3&gt;ReActFinalizer&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Entr&#233;e :&lt;/strong&gt; instance d'agent ReAct.&lt;br /&gt;
&lt;strong&gt;Traitement :&lt;/strong&gt;
Surveille la fin du raisonnement.
D&#233;tecte un &lt;em&gt;FinalAnswer&lt;/em&gt; ou une condition d'arr&#234;t.
Nettoie et finalise la r&#233;ponse.&lt;br /&gt;
&lt;strong&gt;Sortie :&lt;/strong&gt; r&#233;ponse finale propre, pr&#234;te &#224; &#234;tre envoy&#233;e &#224; l'utilisateur.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;3. API du ReActEngine v1&lt;/h1&gt;
&lt;h2&gt;3.1. &lt;code&gt;__init__(...)&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Deux modes d'initialisation :&lt;/p&gt;
&lt;h3&gt;Mode 1 : avec &lt;code&gt;ragkwargs&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Adapt&#233; &#224; une utilisation en mode API, relan&#231;ant l'instanciation &#224; chaque requ&#234;te.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le th&#232;me, la langue, le niveau de d&#233;tail, etc. sont fournis d&#232;s l'instanciation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'agent est imm&#233;diatement op&#233;rationnel.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Mode 2 : sans &lt;code&gt;ragkwargs&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Adapt&#233; &#224; un fonctionnement en mode d&#233;mon ou worker multi-th&#232;mes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'application doit ensuite appeler &lt;code&gt;start()&lt;/code&gt; avec le th&#232;me en argument.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Param&#232;tres cl&#233;s :&lt;/strong&gt;&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;config&lt;/code&gt; : configuration globale (commune &#224; IngestCmd, ChattyBot, ChattyWS&#8230;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;llmapikey&lt;/code&gt; : cl&#233; API MistralAI&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;token&lt;/code&gt; : jeton de s&#233;curit&#233; pour les serveurs de donn&#233;es&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ragkwargs&lt;/code&gt; : dictionnaire contenant au minimum :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;theme&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;detail&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;language&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;3.2. M&#233;thode &lt;code&gt;start()&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;M&#233;thode pour les services REST ou workers persistants.&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;compl&#232;te l'initialisation selon le th&#232;me,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;charge l'index si n&#233;cessaire,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;permet aux applications stateful de fournir leur propre index (optimisation),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;pr&#233;pare l'agent ReAct pour le th&#232;me courant.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Retour : &lt;strong&gt;un objet &lt;code&gt;ReActAgent&lt;/code&gt; pr&#234;t &#224; l'emploi&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;3.3. Gestion de l'historique &#8212; &lt;code&gt;set_history()&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Cette m&#233;thode :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;re&#231;oit un historique &lt;strong&gt;OpenAI-style&lt;/strong&gt; :&lt;br /&gt;
&lt;code&gt;[{ &#034;role&#034;: &#034;user&#034;, &#034;content&#034;: &#034;...&#034; }, ...]&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;nettoie et &lt;strong&gt;compresse&lt;/strong&gt; l'historique pour compatibilit&#233; ReAct,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;stocke :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;self.conversation_history&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;self.compressed_history&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;L'agent est &lt;strong&gt;statique&lt;/strong&gt; :&lt;br /&gt;
&#8594; l'application appelante doit g&#233;rer la persistance de l'historique ( plus pr&#233;cis&#233;ment &#034;historique de conversation&#034; ) et le transmettre avant chaque requ&#234;te.&lt;/p&gt;
&lt;h2&gt;3.4. Ex&#233;cution asynchrone &#8212; &lt;code&gt;stream(prompt)&lt;/code&gt;&lt;/h2&gt;
&lt;h3&gt;Fonctionnement&lt;/h3&gt;
&lt;p&gt;Pour chaque prompt :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ToolRouter&lt;/strong&gt; s&#233;lectionne dynamiquement les outils pertinents&lt;br /&gt;
&#8594; r&#233;duction du contexte, optimisation des co&#251;ts, meilleure pr&#233;cision.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;L'agent ReAct est &lt;strong&gt;reconstruit&lt;/strong&gt; avec uniquement les outils rout&#233;s.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Un &lt;strong&gt;tote bag&lt;/strong&gt; est pr&#233;par&#233; :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;historique compress&#233;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;langue&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;profil (ex. &#034;expert&#034;)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le &lt;strong&gt;ReActFinalizer&lt;/strong&gt; g&#232;re la g&#233;n&#233;ration incr&#233;mentale.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;La m&#233;thode retourne un &lt;strong&gt;AsyncGenerator&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3.5. Ex&#233;cution synchrone &#8212; &lt;code&gt;get_engine_response()&lt;/code&gt;&lt;/h2&gt;
&lt;h3&gt;Fonctionnement&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;r&#233;cup&#232;re l'historique compress&#233; si non fourni,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;applique le ToolRouter,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ex&#233;cute l'agent ReAct,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;retourne une &lt;strong&gt;r&#233;ponse compl&#232;te&lt;/strong&gt; (non stream&#233;e).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h1&gt;4. Mise en &#339;uvre des outils dans ReActAgent&lt;/h1&gt;
&lt;h2&gt;4.1. Les outils&lt;/h2&gt;
&lt;p&gt;L'agent s'appuie sur trois ToolKits compl&#233;mentaires :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;GeneralToolKit&lt;/strong&gt; : outils g&#233;n&#233;riques toujours disponibles.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ThemeToolKit&lt;/strong&gt; : outils m&#233;tier + un &lt;strong&gt;outil RAG&lt;/strong&gt; pour acc&#233;der &#224; la documentation interne.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ToolKit Temps R&#233;el&lt;/strong&gt; : outils connect&#233;s &#224; des sources de donn&#233;es dynamiques (internes/externes).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Voir &#233;galement : &lt;a href='https://ia.dnc.global/ReAct-et-integration-des-donnees-temps-reel-avec-MCP.html' class='spip_in'&gt;ReAct et int&#233;gration des donn&#233;es temps r&#233;el avec MCP ( Model Context Protocol ) &lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;4.2. L'outil RAG dans la boucle ReAct&lt;/h2&gt;
&lt;p&gt;Le RAG (Research Augmented Generation) est int&#233;gr&#233; &lt;strong&gt;comme un outil standard&lt;/strong&gt;, accessible via la logique ReAct.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;R&#244;le du RAG&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Il permet &#224; l'agent d'interroger la documentation interne de l'entreprise, compos&#233;e de :
documents historiques (rapports, notes, logs),
r&#233;f&#233;rentiels documentaires (proc&#233;dures, notices techniques),
routines sp&#233;cialis&#233;es pour guider le raisonnement dans des t&#226;ches r&#233;p&#233;titives.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;Fonction dans ReAct&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Le RAG est utilis&#233; lorsque l'agent doit :
v&#233;rifier une information interne,
s'appuyer sur des documents de r&#233;f&#233;rence,
ex&#233;cuter une t&#226;che n&#233;cessitant un contexte m&#233;tier document&#233;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Le RAG enrichit le raisonnement de l'agent en lui donnant acc&#232;s &#224; la connaissance interne, tout en restant orchestr&#233; par ReAct.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;4.3. le ToolRouter&lt;/h2&gt;
&lt;p&gt;Le ToolRouter identifie automatiquement les outils les plus adapt&#233;s &#224; une requ&#234;te utilisateur gr&#226;ce &#224; un m&#233;canisme de similarit&#233; vectorielle.&lt;/p&gt;
&lt;p&gt;Fonctionnement :
Chaque outil poss&#232;de une description textuelle (m&#233;tadonn&#233;es). Voir : &lt;a href='https://ia.dnc.global/ReAct-l-Intent-Map.html' class='spip_in'&gt;ReAct : la carte des intentions : Intent Map&lt;/a&gt;
Les descriptions et la requ&#234;te utilisateur sont vectoris&#233;es via un mod&#232;le d'embedding.
Le routeur calcule la similarit&#233; cosinus entre la requ&#234;te et chaque outil.
Les outils sont class&#233;s par pertinence.
Le ReActAgent choisit l'outil &#224; appeler en fonction du classement et du contexte.&lt;/p&gt;
&lt;p&gt;&#8594; Le ToolRouter guide la boucle ReAct vers l'outil optimal au moment opportun.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;R&#233;sultat : Un agent capable de combiner raisonnement, outils sp&#233;cialis&#233;s, documentation interne et donn&#233;es temps r&#233;el.&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Le module ModelLoaderFactory ( &#034;la factory&#034; ) </title>
		<link>https://ia.dnc.global/Le-module-ModelLoaderFactory-la-factory.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/Le-module-ModelLoaderFactory-la-factory.html</guid>
		<dc:date>2026-04-02T07:22:02Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Ce document explique la fa&#231;on dont les mod&#232;les locaux sont cr&#233;&#233;s et utilis&#233;s dans un environnement LlamaIndex. On y d&#233;taille : les diff&#233;rences classes structurelles de mod&#232;les locaux, ce qui n&#233;cessite une abstraction pour LlamaIndex, comment le module ModelLoaderFactory ( &#034;la factory&#034; ) assure la cr&#233;ation des mod&#232;les locaux et leur abstraction, le r&#244;le du singleton AppSettings pour exposer les mod&#232;les. &lt;br class='autobr' /&gt; # Diff&#233;rences entre mod&#232;les HuggingFace, SentenceTransformer et mod&#232;les g&#233;n&#233;riques &lt;br class='autobr' /&gt;
Tout d'abord, il (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Ce document explique la fa&#231;on dont les mod&#232;les locaux sont cr&#233;&#233;s et utilis&#233;s dans un environnement LlamaIndex.&lt;br class='autobr' /&gt;
On y d&#233;taille :
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; les diff&#233;rences classes structurelles de mod&#232;les locaux, ce qui n&#233;cessite une abstraction pour LlamaIndex,
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; comment le module ModelLoaderFactory ( &#034;la factory&#034; ) assure la cr&#233;ation des mod&#232;les locaux et leur abstraction,
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; le r&#244;le du &lt;a href='https://ia.dnc.global/AppSettings-un-Singleton-Global-pour-stabiliser-les-modeles-face-aux-limites-du.html' class='spip_in'&gt;singleton AppSettings&lt;/a&gt; pour exposer les mod&#232;les.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h1&gt;Diff&#233;rences entre mod&#232;les HuggingFace, SentenceTransformer et mod&#232;les g&#233;n&#233;riques&lt;/h1&gt;
&lt;p&gt;Tout d'abord, il faut consid&#233;rer que :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;le mod&#232;le d'embedding DOIT &#234;tre celui utilis&#233; par le LLM,&lt;/li&gt;
&lt;li&gt;dans une architecture RAG, il doit &#234;tre le m&#234;me pour l'ingestion, la s&#233;lection et la g&#233;n&#233;ration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Les mod&#232;les d'embeddings utilis&#233;s dans un pipeline RAG ou agentique n'appartiennent pas tous &#224; la m&#234;me famille. Ils diff&#232;rent par leur format, leur API, leur mani&#232;re de produire les embeddings et leur niveau de sp&#233;cialisation. Comprendre ces diff&#233;rences aide &#224; choisir le bon mod&#232;le et &#224; structurer une architecture propre et stable. &lt;/p&gt;
&lt;p&gt;Note : la factory peut &#233;galement g&#233;rer de fa&#231;on similaire des mod&#232;les 'causal LM' ( notamment des LLM ), on se concentre ici sur les mod&#232;les d'embedding. &lt;/p&gt;
&lt;h2&gt;Mod&#232;les HuggingFace (HF Encoders)&lt;/h2&gt;
&lt;p&gt;Les mod&#232;les HF de type &lt;em&gt;encoder&lt;/em&gt; (comme BERT, RoBERTa, MPNet, BGE, E5, GTE, Jina) sont des mod&#232;les Transformers polyvalents. Ils ne sont pas con&#231;us sp&#233;cifiquement pour produire des embeddings, mais ils peuvent le faire.&lt;/p&gt;
&lt;p&gt;Ils utilisent le format standard HuggingFace, avec des fichiers comme &lt;code&gt;config.json&lt;/code&gt;, &lt;code&gt;model.safetensors&lt;/code&gt; et &lt;code&gt;tokenizer.json&lt;/code&gt;. Leur API repose sur l'appel direct du mod&#232;le avec un tokenizer, ce qui renvoie un tenseur PyTorch contenant les repr&#233;sentations de chaque token. Pour obtenir un embedding final, il faut appliquer un pooling manuel (par exemple une moyenne des tokens ou l'utilisation du token CLS).&lt;/p&gt;
&lt;p&gt;Ces mod&#232;les sont tr&#232;s flexibles et peuvent servir &#224; d'autres t&#226;ches que les embeddings, mais ils demandent plus de travail pour produire un vecteur coh&#233;rent et stable. Ils peuvent aussi &#234;tre plus lourds en m&#233;moire et en temps d'inf&#233;rence.&lt;/p&gt;
&lt;h2&gt;Mod&#232;les SentenceTransformer (ST)&lt;/h2&gt;
&lt;p&gt;Les mod&#232;les SentenceTransformer sont construits &#224; partir de mod&#232;les HF, mais ils sont sp&#233;cialement adapt&#233;s pour produire des embeddings de phrases. Ils incluent un pipeline complet : tokenizer, mod&#232;le Transformer et couche de pooling int&#233;gr&#233;e.&lt;/p&gt;
&lt;p&gt;Leur format est diff&#233;rent de celui de HuggingFace : ils utilisent des fichiers comme &lt;code&gt;modules.json&lt;/code&gt; et des sous-dossiers tels que &lt;code&gt;0_Transformer/&lt;/code&gt; et &lt;code&gt;1_Pooling/&lt;/code&gt;. Leur API est simple : une seule m&#233;thode &lt;code&gt;encode(text)&lt;/code&gt; renvoie directement un vecteur numpy pr&#234;t &#224; l'emploi.&lt;/p&gt;
&lt;p&gt;Ces mod&#232;les sont optimis&#233;s pour la similarit&#233; s&#233;mantique, ce qui les rend particuli&#232;rement adapt&#233;s aux syst&#232;mes RAG, aux moteurs de recherche et aux t&#226;ches de clustering. Ils sont plus simples &#224; utiliser que les mod&#232;les HF, mais moins flexibles pour d'autres usages.&lt;/p&gt;
&lt;p&gt;Note : BAAI fournit ses mod&#232;les ( comme BAAI/bge-small-en-v1.5&#034; ) sous les deux formats HF et ST.&lt;/p&gt;
&lt;h2&gt;Mod&#232;les g&#233;n&#233;riques ou personnalis&#233;s&lt;/h2&gt;
&lt;p&gt;Il existe aussi des mod&#232;les qui ne suivent ni le format HF ni celui de SentenceTransformer. Ils peuvent &#234;tre tr&#232;s simples, comme un mod&#232;le maison exposant une m&#233;thode &lt;code&gt;embed(text)&lt;/code&gt;, ou tr&#232;s sp&#233;cialis&#233;s, comme un mod&#232;le ONNX ou quantis&#233; avec une API minimale.&lt;/p&gt;
&lt;p&gt;Ces mod&#232;les n'ont pas de format standard et leur API varie selon l'impl&#233;mentation. Ils peuvent renvoyer des listes Python, des tenseurs ou d'autres structures. Ils sont souvent utilis&#233;s pour les tests, les prototypes ou les environnements tr&#232;s contraints.&lt;/p&gt;
&lt;p&gt;Ils sont faciles &#224; int&#233;grer, mais n&#233;cessitent une couche d'abstraction pour garantir une sortie coh&#233;rente et &#233;viter les comportements impr&#233;visibles.&lt;/p&gt;
&lt;h2&gt;Pourquoi une architecture unifi&#233;e est n&#233;cessaire&lt;/h2&gt;
&lt;p&gt;Les diff&#233;rences entre HF, ST et les mod&#232;les g&#233;n&#233;riques rendent indispensable &lt;strong&gt;une couche d'unification&lt;/strong&gt;. Sans cela, chaque composant du syst&#232;me devrait g&#233;rer des formats diff&#233;rents, des API diff&#233;rentes et des comportements diff&#233;rents.&lt;/p&gt;
&lt;p&gt;L' architecture d&#233;crite par la suite r&#233;sout ce probl&#232;me en trois &#233;tapes :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;la factory installe et valide le mod&#232;le ;&lt;/li&gt;
&lt;li&gt;le wrapper normalise les sorties et fournit une API interne stable ;&lt;/li&gt;
&lt;li&gt;l'adapter expose une API compatible LlamaIndex.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cette approche garantit que tous les mod&#232;les, quelle que soit leur origine, produisent des embeddings coh&#233;rents, normalis&#233;s et utilisables dans l'ensemble du pipeline.&lt;/p&gt;
&lt;h1&gt;Architecture de la cr&#233;ation des mod&#232;les locaux&lt;/h1&gt;
&lt;h2&gt;Objectifs&lt;/h2&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;strong&gt;D&#233;terminisme total&lt;/strong&gt; : aucun fallback, aucune heuristique.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Installation automatique&lt;/strong&gt; au premier appel de la factory, sans lazy-loading des poids. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compatibilit&#233; offline&lt;/strong&gt; : tout fonctionne ensuite sans r&#233;seau. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Normalisation stricte&lt;/strong&gt; : toujours retourner des &lt;code&gt;list[float]&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S&#233;paration nette des responsabilit&#233;s&lt;/strong&gt; : &lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Factory = installation/validation &lt;/li&gt;
&lt;li&gt;Wrapper = normalisation &lt;/li&gt;
&lt;li&gt;Adapter = API LlamaIndex ou autre&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Assurer un &lt;strong&gt;point d'acc&#232;s&lt;/strong&gt; aux API unique et global : AppSettings &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;1. Vue d'ensemble&lt;/h2&gt;
&lt;p&gt;Le chargement d'un mod&#232;le repose sur trois couches clairement s&#233;par&#233;es :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ModelLoaderFactory&lt;/strong&gt; &lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Installe, valide et instancie les mod&#232;les HF/ST. &lt;/li&gt;
&lt;li&gt;Garantit un fonctionnement d&#233;terministe, sans fallback ni heuristique.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;UniversalEmbeddingWrapper&lt;/strong&gt; Normalisation et abstraction du backend : &lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Unifie tous les backends (HF, ST, g&#233;n&#233;rique). &lt;/li&gt;
&lt;li&gt;Fournit une API interne stable : &lt;code&gt;embed(str) -&gt; list[float]&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;et, dans le cas d'un mod&#232;le d'embeddings :&lt;/p&gt;
&lt;ol start=&#034;3&#034;&gt;
&lt;li&gt;&lt;strong&gt;LlamaIndexEmbeddingAdapter&lt;/strong&gt; &lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Expose l'API LlamaIndex (&lt;code&gt;get_text_embedding&lt;/code&gt;, &lt;code&gt;get_query_embedding&lt;/code&gt;). &lt;/li&gt;
&lt;li&gt;Utilise le wrapper pour garantir la normalisation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Le r&#233;sultat est stock&#233; dans le &lt;strong&gt;singleton global&lt;/strong&gt; , &lt;code&gt;AppSettings.embed_model&lt;/code&gt; devient le mod&#232;le d'embeddings pour tout le syst&#232;me.&lt;/p&gt;
&lt;h2&gt;2. Chargement du mod&#232;le via la factory&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;factory = ModelLoaderFactory() embedding = factory.create_embedding( model_path= &#034;/home/iadnc/.models/bge-small, model_name= &#034;BAAI/bge-small-en-v1.5&#034;, model_type= &#034;sentence_transformer&#034;, device= &#034;cuda&#034;
)&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Ce que fait la factory :&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;S&#233;lectionne l'installateur appropri&#233; (&lt;code&gt;HFInstaller&lt;/code&gt;, &lt;code&gt;STInstaller&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Installe ou valide le mod&#232;le dans &lt;code&gt;model_path&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;D&#233;tecte le type r&#233;el du mod&#232;le (HF, ST, causal LM).&lt;/li&gt;
&lt;li&gt;V&#233;rifie la coh&#233;rence entre type d&#233;clar&#233; et type d&#233;tect&#233;.&lt;/li&gt;
&lt;li&gt;Instancie l'embedding RAM (&lt;code&gt;HFEmbedding&lt;/code&gt; ou &lt;code&gt;STEmbedding&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;R&#233;sultat :&lt;/strong&gt; un embedding brut, non encore adapt&#233; &#224; LlamaIndex.&lt;/p&gt;
&lt;h2&gt;3. Construction du singleton &lt;code&gt;AppSettings.embed_model&lt;/code&gt;&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;AppSettings.embed_model = create_llamaindex_embedding(embedding)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cette fonction construit la &lt;strong&gt;cha&#238;ne API compl&#232;te&lt;/strong&gt; :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AppSettings.embed_model
&#9500;&#9472;&#9472; wrapper (UniversalEmbeddingWrapper)
&#9474; &#9492;&#9472;&#9472; embedding (HFEmbedding ou STEmbedding)
&#9492;&#9472;&#9472; get_*_embedding() (API LlamaIndex BaseEmbedding)&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Architecture&lt;/h3&gt;&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt; &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;&lt;br /&gt; &#9474; ModelLoaderFactory &#9474;&lt;br /&gt; &#9474; (installation + RAM) &#9474;&lt;br /&gt; &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;&lt;br /&gt; &#9474;&lt;br /&gt; &#9660;&lt;br /&gt; Embedding RAM instanci&#233; &lt;br /&gt; &lt;br /&gt; HFEmbedding (HF) | STEmbedding (ST) | Generic &lt;br /&gt; - tensor output | - numpy output | - list &lt;br /&gt; - pooling manuel | - pooling int&#233;gr&#233; | - API custom&lt;br /&gt; &lt;br /&gt; &#9474;&lt;br /&gt; &#9660;&lt;br /&gt; &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;&lt;br /&gt; &#9474; UniversalEmbeddingWrapper &#9474;&lt;br /&gt; &#9474; embed(str) -&gt; list[float] &#9474;&lt;br /&gt; &#9474; backend = HF / ST / generic &#9474;&lt;br /&gt; &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;&lt;br /&gt; &#9474;&lt;br /&gt; &#9660;&lt;br /&gt; &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;&lt;br /&gt; &#9474; LlamaIndexEmbeddingAdapter &#9474;&lt;br /&gt; &#9474; get_text_embedding() &#9474;&lt;br /&gt; &#9474; get_query_embedding() &#9474;&lt;br /&gt; &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9516;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;&lt;br /&gt; &#9474;&lt;br /&gt; &#9660;&lt;br /&gt; &#9484;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9488;&lt;br /&gt; &#9474; AppSettings.embed_model &#9474;&lt;br /&gt; &#9474; (singleton global complet) &#9474;&lt;br /&gt; &#9474; &#9474;&lt;br /&gt; &#9474; &#9500;&#9472;&#9472; wrapper &#9474;&lt;br /&gt; &#9474; &#9474; &#9492;&#9472;&#9472; embedding (HF/ST) &#9474;&lt;br /&gt; &#9474; &#9492;&#9472;&#9472; get_*_embedding() &#9474;&lt;br /&gt; &#9492;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9496;&lt;/code&gt;&lt;/div&gt;&lt;p&gt;Le singleton AppSettings permet d'acc&#233;der &#224; &lt;strong&gt;trois niveaux d'API&lt;/strong&gt;, chacun avec un r&#244;le clair :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;API interne&lt;/strong&gt; :&lt;br /&gt;
&lt;code&gt;AppSettings.embed_model.wrapper.embed(&#034;texte&#034;)&lt;/code&gt;&lt;br /&gt;
&#8594; utilis&#233;e par les compresseurs, le RAG, les agents.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;API LlamaIndex&lt;/strong&gt; :&lt;br /&gt;
&lt;code&gt;AppSettings.embed_model.get_text_embedding(&#034;texte&#034;)&lt;/code&gt;&lt;br /&gt;
&#8594; utilis&#233;e par les index, retrievers, query engines.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;API mod&#232;le brut&lt;/strong&gt; :&lt;br /&gt;
&lt;code&gt;AppSettings.embed_model.wrapper.embedding.model&lt;/code&gt;&lt;br /&gt;
&#8594; utile pour debug, tests, op&#233;rations avanc&#233;es.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;4. Exemples d'usage&lt;/h2&gt;
&lt;h3&gt;API interne (wrapper)&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;vec = AppSettings.embed_model.wrapper.embed(&#034;Bonjour&#034;)&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;API LlamaIndex&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;vec = AppSettings.embed_model.get_text_embedding(&#034;Bonjour&#034;)&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;API mod&#232;le HF/ST brut&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;hf_model = AppSettings.embed_model.wrapper.embedding.model&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;En savoir plus :&lt;/strong&gt;
&lt;br /&gt;&lt;span class=&#034;spip-puce ltr&#034;&gt;&lt;b&gt;&#8211;&lt;/b&gt;&lt;/span&gt; &lt;a href='https://ia.dnc.global/AppSettings-un-Singleton-Global-pour-stabiliser-les-modeles-face-aux-limites-du.html' class='spip_in'&gt;AppSettings : un Singleton Global pour stabiliser les mod&#232;les face aux limites du singleton LlamaIndex&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div &lt;div class='rss_ps'&gt;&lt;p&gt; &lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;#! python3&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# coding: utf8&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# PythonApp/commons/model_loader_factory.py&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;''' &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Classe ModelLoaderFactory&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;## Usage pour un mod&#232;le d'embedding :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;embedding = factory.create_embedding(&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;app_settings.embed_model = create_llamaindex_embedding(embedding)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Voir : https://ia.dnc.global/Preparation-et-utilisation-des-modeles-locaux-pour-LlamaIndex.html&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Auteur : B.Degoy bertrand@degoy.com &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;copyright (c) 2026 B.Degoy&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;licence : All rights reserved - Tous droits r&#233;serv&#233;s&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;v 0.0.1&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;2026/02/16-20 (t=9h)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;'''&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Standard imports&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; typing &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; List&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; pathlib &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Path&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; json&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; sentence_transformers &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; SentenceTransformer&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; transformers &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; AutoModel&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; AutoTokenizer&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; PreTrainedModel&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Third-party Imports&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; llama_index.&lt;span style=&#034;color: black;&#034;&gt;core&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embeddings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; BaseEmbedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; huggingface_hub &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; hf_hub_download&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; list_repo_files&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; langchain.&lt;span style=&#034;color: black;&#034;&gt;embeddings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;base&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Embeddings &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; LCEmbeddings&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;#TODO Futurs installateurs (&#224; ajouter progressivement) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# from commons.installers.hf_seq2seq_installer import HFSeq2SeqInstaller&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# from commons.installers.onnx_installer import ONNXInstaller&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# from commons.installers.gguf_installer import GGUFInstaller&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Fonction utilitaire : assemble wrapper + adapter&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; create_llamaindex_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; wrapper &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; UniversalEmbeddingWrapper&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; LlamaIndexEmbeddingAdapter&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; wrapper&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;wrapper&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;embedding.&lt;span style=&#034;color: black;&#034;&gt;model_name&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; numpy &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; np&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; UniversalEmbeddingWrapper:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Couche d'unification des embeddings garantissant une interface unique,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; stable et normalis&#233;e pour tous les backends utilis&#233;s dans le syst&#232;me.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette classe encapsule un objet d'embedding arbitraire (HFEmbedding,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; STEmbedding, mod&#232;le g&#233;n&#233;rique, mock de test, etc.) et fournit une API&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; minimale mais strictement d&#233;finie :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; embed(str) -&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ind&#233;pendamment du backend r&#233;el. Elle &#233;limine ainsi toute ambigu&#239;t&#233; sur le&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; format de sortie et prot&#232;ge les couches sup&#233;rieures (compresseurs,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; LlamaIndexEmbeddingAdapter, moteurs RAG, etc.) contre les variations&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; d'impl&#233;mentation des biblioth&#232;ques tierces.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;tection du backend&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; --------------------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Le wrapper identifie le type d'embedding fourni selon les attributs pr&#233;sents :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - SentenceTransformer &#8594; pr&#233;sence de `embed_documents`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - HFEmbedding custom &#8594; pr&#233;sence de `_get_text_embedding`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Embedding g&#233;n&#233;rique &#8594; pr&#233;sence de `embed`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Sinon &#8594; backend inconnu (erreur explicite)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette d&#233;tection est volontairement simple, explicite et d&#233;terministe :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; aucune heuristique, aucun fallback, aucune supposition implicite.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Normalisation des sorties&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; -------------------------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Les backends peuvent renvoyer diff&#233;rents formats :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - numpy.ndarray&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - torch.Tensor&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - objets HF/ST sp&#233;cifiques&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Le wrapper applique syst&#233;matiquement :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - si l'objet poss&#232;de `.tolist()` &#8594; conversion en liste Python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - si c'est d&#233;j&#224; une liste &#8594; renvoi direct&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - sinon &#8594; conversion explicite via `list(v)`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Garanties&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ---------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Sortie toujours en `list[float]`, quel que soit le backend.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Fonctionnement d&#233;terministe et compatible offline.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucune prise en charge de `embed(list[str])` : la m&#233;thode ne traite&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; que des cha&#238;nes individuelles, conform&#233;ment aux invariants du syst&#232;me.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Protection contre les comportements implicites ou non document&#233;s des&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; biblioth&#232;ques tierces.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; embedding : object&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instance d'un backend d'embedding (HF, ST, g&#233;n&#233;rique, mock, etc.)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; fournissant au minimum une m&#233;thode d'encodage compatible avec l'un&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; des backends d&#233;tect&#233;s.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; &lt;span style=&#034;color: #0000cd;&#034;&gt;__init__&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; embedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;backend&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._detect_backend&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _detect_backend&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;embed_documents&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;st_embedding&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;_get_text_embedding&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_embedding&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;embed&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;generic_embedding&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;unknown&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; embed&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; text: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;float&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;Normalise toutes les sorties en list[float].&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;backend&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_embedding&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; arr &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;._get_text_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;text&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;arr&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; arr&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; arr.&lt;span style=&#034;color: black;&#034;&gt;tolist&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;backend&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;st_embedding&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; arr_list &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed_documents&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;text&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; v &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; arr_list&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #ff4500;&#034;&gt;0&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;v&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; v&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; v.&lt;span style=&#034;color: black;&#034;&gt;tolist&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;backend&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;generic_embedding&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; arr &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;text&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;isinstance&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;arr&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; arr&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; arr.&lt;span style=&#034;color: black;&#034;&gt;tolist&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Backend inconnu&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; llama_index.&lt;span style=&#034;color: black;&#034;&gt;core&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embeddings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; BaseEmbedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; pydantic &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Field&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; pydantic &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; ConfigDict&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; LlamaIndexEmbeddingAdapter&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;BaseEmbedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Adaptateur entre UniversalEmbeddingWrapper et l'API BaseEmbedding de LlamaIndex.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette classe fournit une couche d'int&#233;gration stable et minimale permettant&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; d'utiliser n'importe quel backend d'embeddings (HF, SentenceTransformer,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; embeddings g&#233;n&#233;riques, mod&#232;les locaux, etc.) au sein de LlamaIndex, tout en&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; respectant strictement les invariants du wrapper universel :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Toutes les sorties sont normalis&#233;es en `list[float]`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun appel `embed(list[str])` n'est autoris&#233; : l'adapter boucle&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; explicitement sur les listes de textes.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Les m&#233;thodes sync/async de BaseEmbedding sont correctement impl&#233;ment&#233;es.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le comportement est d&#233;terministe et thread-safe.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; wrapper : UniversalEmbeddingWrapper&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Wrapper unifi&#233; fournissant la m&#233;thode `embed(str) -&gt; list[float]`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; L'adapter d&#233;l&#232;gue tous les calculs d'embeddings &#224; ce wrapper.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;#Pydantic v2&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; model_config &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; ConfigDict&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;extra&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;allow&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; wrapper: &lt;span style=&#034;color: #008000;&#034;&gt;object&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; Field&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;...&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; model_name: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; Field&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;default&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;unknown&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; &lt;span style=&#034;color: #0000cd;&#034;&gt;__init__&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; wrapper&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;unknown&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;super&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: #0000cd;&#034;&gt;__init__&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; wrapper&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;wrapper&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; describe&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; cls &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.__class__.__name__&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;{cls}:&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\n&lt;/span&gt;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034; model_name : {self.model_name}&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\n&lt;/span&gt;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034; wrapper : {self.wrapper.__class__.__name__}&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\n&lt;/span&gt;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034; embedding : {self.wrapper.embedding.model_name}&lt;span style=&#034;color: #000099; font-weight: bold;&#034;&gt;\n&lt;/span&gt;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;property&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; embedding_root&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;wrapper&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embedding&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _to_list&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; v&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Convertit un vecteur en liste Python.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode garantit que les embeddings renvoy&#233;s par les backends&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; (NumPy, Torch, HF, ST, etc.) sont convertis proprement en `list[float]`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Si `v` est d&#233;j&#224; une liste Python, elle est renvoy&#233;e telle quelle.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; v : array-like&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Vecteur d'embedding potentiel (numpy.ndarray, torch.Tensor, list).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding converti en liste Python.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;v&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;tolist&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; v.&lt;span style=&#034;color: black;&#034;&gt;tolist&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;v&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# --- M&#233;thodes priv&#233;es requises par BaseEmbedding ---&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _get_query_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; query: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding d'une requ&#234;te utilisateur (m&#233;thode interne LlamaIndex).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode est appel&#233;e par LlamaIndex pour encoder les requ&#234;tes&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; textuelles. Elle d&#233;l&#232;gue directement au wrapper universel, garantissant&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; une sortie normalis&#233;e en `list[float]`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; query : str&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Texte de la requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding de la requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;wrapper&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;query&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _get_text_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; text: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding d'un document ou d'un chunk (m&#233;thode interne LlamaIndex).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; LlamaIndex appelle cette m&#233;thode pour encoder les documents ou les&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; chunks lors de la construction d'index. Le wrapper universel garantit&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; une sortie coh&#233;rente et normalis&#233;e.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; text : str&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Texte &#224; encoder.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding du texte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;wrapper&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;text&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; async &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _aget_query_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; query: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Version asynchrone de l'embedding de requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Comme le wrapper universel ne fournit qu'une API synchrone, cette&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; m&#233;thode utilise `asyncio.to_thread` pour ex&#233;cuter l'embedding dans un&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; thread s&#233;par&#233;, garantissant la compatibilit&#233; avec les pipelines async&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; de LlamaIndex.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; query : str&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Requ&#234;te utilisateur.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding de la requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# wrapper.embed() est sync, on passe par asyncio.to_thread&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; asyncio&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; await asyncio.&lt;span style=&#034;color: black;&#034;&gt;to_thread&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;wrapper&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; query&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# --- M&#233;thodes publiques ---&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; get_query_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; query: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; API publique LlamaIndex pour encoder une requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode est un simple proxy vers `_get_query_embedding`, afin de&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; respecter l'interface publique de BaseEmbedding.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; query : str&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Requ&#234;te utilisateur.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding de la requ&#234;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._get_query_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;query&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; get_text_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; text: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; API publique LlamaIndex pour encoder un texte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Proxy direct vers `_get_text_embedding`, utilis&#233; par les indexeurs et&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; les moteurs de recherche internes de LlamaIndex.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; text : str&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Texte &#224; encoder.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[float]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Embedding du texte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._get_text_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;text&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; get_text_embeddings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; texts: &lt;span style=&#034;color: #008000;&#034;&gt;list&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Encode une liste de textes.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Le wrapper universel ne supportant pas `embed(list[str])`, cette m&#233;thode&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; applique explicitement `embed()` sur chaque &#233;l&#233;ment. Cela garantit une&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; compatibilit&#233; totale avec BaseEmbedding et &#233;vite les erreurs de type.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ----------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; texts : list[str]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Liste de textes &#224; encoder.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; list[list[float]]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Liste d'embeddings, un par texte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# wrapper n'a pas embed(list), on boucle&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;wrapper&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;t&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;for&lt;/span&gt; t &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; texts&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; ModelLoaderFactory:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Fabrique centralis&#233;e et d&#233;terministe pour l'installation, la validation et&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; l'instanciation des mod&#232;les d'embeddings et des mod&#232;les CausalLM.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette classe constitue le point d'entr&#233;e unique pour charger des mod&#232;les&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; locaux ou distants dans un environnement strictement contr&#244;l&#233;. Elle impose&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; une discipline forte : aucun comportement implicite, aucune heuristique,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; aucune d&#233;tection automatique du type de mod&#232;le. L'appelant doit fournir&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; explicitement le type attendu, et toute incoh&#233;rence entre le type d&#233;clar&#233;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; et la structure r&#233;elle du mod&#232;le install&#233; entra&#238;ne une erreur imm&#233;diate.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; R&#244;le et garanties&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; -----------------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Gestion centralis&#233;e de l'installation via des installateurs sp&#233;cialis&#233;s&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; (HFInstaller, STInstaller, HFInstallerCausalLM).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Validation stricte de la structure locale du mod&#232;le :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * HF : lecture de config.json + v&#233;rification des poids.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * SentenceTransformer : pr&#233;sence de modules.json + 1_Pooling.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun fallback, aucune r&#233;cup&#233;ration implicite, aucun acc&#232;s r&#233;seau dans&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; les m&#233;thodes de cr&#233;ation (l'installation peut t&#233;l&#233;charger, mais jamais&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; create_embedding / create_causal_lm).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Fonctionnement 100 % d&#233;terministe et compatible offline apr&#232;s installation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Registry interne permettant de suivre les mod&#232;les charg&#233;s en RAM et de&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; les d&#233;charger proprement (GPU/CPU + GC).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; M&#233;thodes&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; ------------&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - create_embedding() :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instancie un embedding RAM (HFEmbedding ou STEmbedding) apr&#232;s installation&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; et validation stricte du mod&#232;le.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - create_causal_lm() :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instancie un moteur CausalLM local (HFCausalLMEngine) apr&#232;s validation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - _select_installer() :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; S&#233;lection explicite de l'installateur en fonction du type d&#233;clar&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - _detect_local_model_type() :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;tection stricte du type r&#233;el du mod&#232;le install&#233;, sans heuristique.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - unload_model() :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;charge proprement un mod&#232;le&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; &lt;span style=&#034;color: #0000cd;&#034;&gt;__init__&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# R&#233;gistre interne&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Entr&#233;e principale : cr&#233;ation d'un embedding RAM&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; create_embedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_path: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_type: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; device: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cr&#233;e un embedding RAM &#224; partir d'un mod&#232;le local ou distant sans aucun comportement implicite.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode ne tente jamais de d&#233;duire automatiquement le type de mod&#232;le. Le type&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; doit &#234;tre fourni explicitement par l'appelant (ex. &#034;hf_encoder&#034;, &#034;sentence_transformer&#034;).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Aucun fallback, aucune heuristique et aucune d&#233;tection distante (HuggingFace Hub) ne&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; sont effectu&#233;s ( parce que c'est impossible du fait que les mod&#232;les en cache HF n'ont g&#233;n&#233;ralement pas de fichier config.json). &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Toute incoh&#233;rence entre le type d&#233;clar&#233; et la structure du mod&#232;le install&#233; entra&#238;ne une erreur explicite.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Pipeline :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 1. S&#233;lection de l'installateur correspondant au type d&#233;clar&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun choix automatique : l'appelant est responsable du type.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Si le type n'est pas support&#233; &#8594; RuntimeError.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 2. Installation ou validation du mod&#232;le dans `model_path`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - L'installateur garantit une installation idempotente et d&#233;terministe.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Si le mod&#232;le est absent ou incomplet &#8594; installation compl&#232;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Si le mod&#232;le est pr&#233;sent &#8594; validation stricte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun fallback, aucune r&#233;cup&#233;ration implicite.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 3. D&#233;tection locale du type r&#233;el du mod&#232;le install&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Lecture de `config.json` (HF) ou `modules.json` (ST).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Si la structure locale ne correspond pas au type d&#233;clar&#233; &#8594; RuntimeError.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 4. Instanciation de l'embedding RAM appropri&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - HFEmbedding pour &#034;hf_encoder&#034;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - STEmbedding pour &#034;sentence_transformer&#034;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun autre type n'est support&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Garanties :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Fonctionnement strictement d&#233;terministe : aucun comportement cach&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Compatibilit&#233; offline totale apr&#232;s installation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Pas d'acc&#232;s r&#233;seau dans cette m&#233;thode.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Pas de d&#233;pendance au cache HuggingFace Hub.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Pas de heuristique, pas de fallback, pas de supposition.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Validation syst&#233;matique de la coh&#233;rence entre type d&#233;clar&#233; et type d&#233;tect&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_path (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Chemin local o&#249; installer ou valider le mod&#232;le.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Peut &#234;tre un dossier vide ou un dossier contenant une installation existante.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_name (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Nom du mod&#232;le HuggingFace (ex. &#034;BAAI/bge-small-en-v1.5&#034;).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Utilis&#233; uniquement par l'installateur pour t&#233;l&#233;charger le mod&#232;le si n&#233;cessaire.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_type (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Type explicite du mod&#232;le. Doit &#234;tre l'un des types support&#233;s :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - &#034;hf_encoder&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - &#034;sentence_transformer&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Toute autre valeur entra&#238;ne une erreur imm&#233;diate.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; device (str | None) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Device d'ex&#233;cution (&#034;cpu&#034;, &#034;cuda&#034;, etc.).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Si None &#8594; s&#233;lection automatique par l'embedding.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instance d'un embedding en RAM (CustomHFEmbedding, CustomSTEmbedding).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Exceptions :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; RuntimeError :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Type de mod&#232;le non support&#233;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Incoh&#233;rence entre type d&#233;clar&#233; et type d&#233;tect&#233; localement.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Mod&#232;le local invalide ou structure incorrecte.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - &#201;chec d'installation ou de validation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_causal_lm&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Un mod&#232;le CausalLM ne peut pas &#234;tre instanci&#233; comme embedding. Utiliser create_causal_lm&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Installer le mod&#232;le via l'installateur d&#233;fini&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; installer &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._select_installer&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;model_type&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; local_path &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; installer.&lt;span style=&#034;color: black;&#034;&gt;resolve&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;model_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# D&#233;tecter le type local pour validation&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; detected &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._detect_local_model_type&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;Path&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;local_path&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; detected :&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Incoh&#233;rence : mod&#232;le d&#233;clar&#233; '{model_type}' mais d&#233;tect&#233; '{detected}'&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Instancier l'embedding RAM&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;sentence_transformer&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;embeddings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;st_embeddings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; STEmbedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; embedding &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; STEmbedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;local_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; device&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; embedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; embedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_encoder&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;embeddings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;hf_embeddings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; HFEmbedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; embedding &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; HFEmbedding&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;local_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; device&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; embedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; embedding&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Aucun embedding disponible pour le type : {model_type}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; create_causal_lm&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_path: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; device: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instancie un mod&#232;le HuggingFace CausalLM (g&#233;n&#233;ratif) en RAM de mani&#232;re&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; strictement d&#233;terministe, apr&#232;s installation locale compl&#232;te et validation&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; structurelle.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode est l'&#233;quivalent &#034;g&#233;n&#233;ration&#034; de `create_embedding()`. Elle ne&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; traite que les mod&#232;les de type `hf_causal_lm`, c'est-&#224;-dire les mod&#232;les&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; autoregressifs compatibles avec `AutoModelForCausalLM` (LLaMA, Mistral,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; GPT-like, Qwen, Phi, Gemma, etc.).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#201;tapes garanties :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 1. Installation stricte et idempotente via HFInstallerCausalLM :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - T&#233;l&#233;chargement explicite de tous les fichiers du repo HF.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun fallback r&#233;seau apr&#232;s installation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun recours au cache HF.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Support des mod&#232;les sharded.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Validation stricte de la structure CausalLM.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 2. D&#233;tection locale du type r&#233;el du mod&#232;le via `_detect_local_model_type()`.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le type d&#233;tect&#233; doit &#234;tre exactement &#034;hf_causal_lm&#034;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Toute incoh&#233;rence entra&#238;ne une erreur explicite.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; 3. Instanciation du moteur de g&#233;n&#233;ration HFCausalLMEngine :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Chargement RAM du mod&#232;le.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Configuration explicite du device.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Enregistrement dans le registre interne pour r&#233;utilisation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_path (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Chemin local o&#249; le mod&#232;le doit &#234;tre install&#233; ou d&#233;j&#224; pr&#233;sent.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Le dossier est cr&#233;&#233; si n&#233;cessaire.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_name (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Nom du mod&#232;le HuggingFace (repo_id) &#224; installer et charger.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; device (str, optionnel) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Device explicite pour l'inf&#233;rence (&#034;cpu&#034;, &#034;cuda&#034;, &#034;cuda:0&#034;, etc.).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Si None, le moteur applique sa logique interne.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; HFCausalLMEngine :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Instance pr&#234;te &#224; l'emploi du mod&#232;le CausalLM charg&#233; en RAM.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Exceptions :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; RuntimeError :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le mod&#232;le install&#233; n'est pas d&#233;tect&#233; comme &#034;hf_causal_lm&#034;.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Structure locale invalide ou incompl&#232;te.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Installation impossible ou incoh&#233;rente.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Toute violation du contrat de d&#233;terminisme ou de validation.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Notes :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Cette m&#233;thode ne doit jamais &#234;tre utilis&#233;e pour des embeddings.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Les mod&#232;les CausalLM sont distinct des encodeurs HF et des SentenceTransformers dans leur architecture.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; installer &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; HFInstallerCausalLM&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; local_path &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; installer.&lt;span style=&#034;color: black;&#034;&gt;resolve&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;model_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; detected &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._detect_local_model_type&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;Path&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;local_path&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; detected &lt;span style=&#034;color: #66cc66;&#034;&gt;!=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_causal_lm&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Incoh&#233;rence : mod&#232;le d&#233;clar&#233; 'hf_causal_lm' mais d&#233;tect&#233; '{detected}'&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;hf_causal_lm&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; HFCausalLMEngine&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; engine &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; HFCausalLMEngine&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;local_path&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; device&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; engine&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; engine&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# S&#233;lection de l'installateur&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _select_installer&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_type: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;sentence_transformer&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;installers&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;st_installer&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; STInstaller&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; STInstaller&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_encoder&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;installers&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;hf_installer&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; HFInstaller&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; HFInstaller&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_causal_lm&#034;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;installers&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;hf_causal_installer&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; HFInstallerCausalLM&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; HFInstallerCausalLM&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Aucun installateur disponible pour le type : {model_type}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; _detect_local_model_type&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; path: Path&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;termine les types r&#233;els d'un mod&#232;le install&#233; localement en inspectant&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; uniquement la structure du dossier, sans heuristiques implicites ni&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; priorit&#233; arbitraire.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Certains mod&#232;les (ex. BAAI/BGE, E5, GTE, Jina) peuvent exposer&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; simultan&#233;ment une structure HuggingFace et une structure&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; SentenceTransformer. Cette m&#233;thode d&#233;tecte donc tous les formats&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; pr&#233;sents et renvoie une liste de types possibles.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;tection :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Format HuggingFace (HF) si :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * un fichier config.json lisible contient un champ &#034;model_type&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * au moins un fichier de poids HF est pr&#233;sent&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; (model.safetensors, pytorch_model.bin, *.index.json)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * si model_type in {llama, mistral, gpt2, qwen, phi, gemma}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; -&gt; &#034;hf_causal_lm&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * sinon si model_type in {bert, roberta, mpnet, bge, e5, gte, jina}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; -&gt; &#034;hf_encoder&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Format SentenceTransformer si :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * modules.json est pr&#233;sent&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; * le dossier 1_Pooling/ existe&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Retour :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Liste des types d&#233;tect&#233;s, par exemple :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; [&#034;hf_encoder&#034;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; [&#034;sentence_transformer&#034;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; [&#034;hf_encoder&#034;, &#034;sentence_transformer&#034;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; [&#034;hf_causal_lm&#034;]&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Exceptions :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; RuntimeError si aucune structure valide n'est d&#233;tect&#233;e ou si les&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; fichiers pr&#233;sents sont incoh&#233;rents ou non support&#233;s.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# --- D&#233;tection HuggingFace ---&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; config_path &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; path / &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;config.json&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; config_path.&lt;span style=&#034;color: black;&#034;&gt;exists&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; cfg &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; json.&lt;span style=&#034;color: black;&#034;&gt;loads&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;config_path.&lt;span style=&#034;color: black;&#034;&gt;read_text&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;as&lt;/span&gt; e:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] config.json illisible dans {path} : {e}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; cfg_model_type &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; cfg.&lt;span style=&#034;color: black;&#034;&gt;get&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;model_type&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;lower&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; cfg_model_type:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] config.json ne contient pas 'model_type' dans {path}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; weight_files &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;model.safetensors&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;pytorch_model.bin&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;pytorch_model.bin.index.json&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;any&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;path / wf&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;exists&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;for&lt;/span&gt; wf &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; weight_files&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; causal_types &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;llama&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;mistral&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;gpt2&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;qwen&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;phi&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;gemma&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; cfg_model_type &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; causal_types:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;append&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_causal_lm&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; hf_supported &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;bert&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;roberta&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;mpnet&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;bge&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;e5&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;gte&#034;&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;jina&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; cfg_model_type &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; hf_supported:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;append&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;hf_encoder&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Type HF non support&#233; : '{cfg_model_type}' dans {path}. &#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;Types support&#233;s : {sorted(hf_supported)}&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# --- D&#233;tection SentenceTransformer ---&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;path / &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;modules.json&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;exists&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;path / &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;1_Pooling&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;exists&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;append&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;sentence_transformer&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# --- Aucun type d&#233;tect&#233; ---&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Impossible de d&#233;terminer le type de mod&#232;le dans {path}&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;types&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; unload_model&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; model_name: &lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; D&#233;sinstalle compl&#232;tement un mod&#232;le de la RAM, en supprimant toutes les&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; r&#233;f&#233;rences Python connues, en nettoyant le registry interne, et en&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; vidant les caches PyTorch. Cette m&#233;thode garantit qu'aucun r&#233;sidu&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; m&#233;moire ne persiste apr&#232;s d&#233;chargement.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; R&#232;gles contractuelles :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le mod&#232;le doit avoir &#233;t&#233; charg&#233; via ModelLoaderFactory.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le registry interne doit contenir une entr&#233;e pour ce mod&#232;le.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Le d&#233;chargement supprime :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - l'objet embedding (STEmbedding ou HFEmbedding)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - le mod&#232;le HF ou SentenceTransformer sous-jacent&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - les buffers internes &#233;ventuels&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - les r&#233;f&#233;rences dans le registry&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Les caches PyTorch sont vid&#233;s explicitement.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Aucun fallback, aucune suppression silencieuse.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Param&#232;tres :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; model_name (str) :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Nom du mod&#232;le tel qu'enregistr&#233; dans le registry RAM.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; Exceptions :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; RuntimeError :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; - Si le mod&#232;le n'est pas pr&#233;sent dans le registry.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; &#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# V&#233;rifier la pr&#233;sence dans le registry&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; model_name &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;not&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;in&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[ModelLoaderFactory] Impossible de d&#233;charger '{model_name}' : &#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; f&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;aucune entr&#233;e dans le registry RAM.&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; embedding &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Supprimer les r&#233;f&#233;rences internes du wrapper&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;embedding&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;model&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;del&lt;/span&gt; embedding.&lt;span style=&#034;color: black;&#034;&gt;model&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;hasattr&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;embedding&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;tokenizer&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;del&lt;/span&gt; embedding.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Supprimer l'entr&#233;e du registry&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;del&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;._registry&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;model_name&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Nettoyage PyTorch&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;try&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; torch&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; torch.&lt;span style=&#034;color: black;&#034;&gt;cuda&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;empty_cache&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; torch.&lt;span style=&#034;color: black;&#034;&gt;cuda&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;ipc_collect&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;except&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;Exception&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;pass&lt;/span&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# CPU-only ou PyTorch non install&#233;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Garbage collector Python&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;gc&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;gc&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;collect&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/ea055e2c4beca63caf80818bb72f2c91.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>AppSettings : un Singleton Global pour stabiliser les mod&#232;les face aux limites du singleton LlamaIndex</title>
		<link>https://ia.dnc.global/AppSettings-un-Singleton-Global-pour-stabiliser-les-modeles-face-aux-limites-du.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/AppSettings-un-Singleton-Global-pour-stabiliser-les-modeles-face-aux-limites-du.html</guid>
		<dc:date>2026-03-30T10:12:26Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Dans une architecture utilisant LlamaIndex, la gestion des mod&#232;les (LLM, embeddings, tokenizer, etc.) repose sur des m&#233;canismes internes du framework. &lt;br class='autobr' /&gt;
Ces m&#233;canismes fonctionnent correctement dans des cas simples, mais pr&#233;sentent plusieurs limites structurelles dans un &#233;cosyst&#232;me d'applications devant partager des mod&#232;les identiques. &lt;br class='autobr' /&gt;
Le &#8220;singleton&#8221; interne de LlamaIndex n'est ni strict, ni stable, et peut &#234;tre r&#233;initialis&#233; ou modifi&#233; de mani&#232;re implicite selon l'ordre des imports, les contextes (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Dans une architecture utilisant LlamaIndex, la gestion des mod&#232;les (LLM, embeddings, tokenizer, etc.) repose sur des m&#233;canismes internes du framework.&lt;/p&gt;
&lt;p&gt;Ces m&#233;canismes fonctionnent correctement dans des cas simples, mais pr&#233;sentent plusieurs limites structurelles dans un &#233;cosyst&#232;me d'applications devant partager des mod&#232;les identiques.&lt;/p&gt;
&lt;p&gt;Le &#8220;singleton&#8221; interne de LlamaIndex n'est ni strict, ni stable, et peut &#234;tre r&#233;initialis&#233; ou modifi&#233; de mani&#232;re implicite selon l'ordre des imports, les contextes d'ex&#233;cution ou les workers.
Cela conduit &#224; des comportements non d&#233;terministes, difficiles &#224; diagnostiquer, et parfois dangereux (mod&#232;les diff&#233;rents selon les modules ou les workers).
Pour stabiliser l'ensemble, il est n&#233;cessaire d'introduire un singleton global explicite, contr&#244;l&#233;, verrouill&#233;, tra&#231;able et idempotent : c'est le r&#244;le de &lt;code&gt;AppSettings&lt;/code&gt; et &lt;code&gt;AppSettingsManager&lt;/code&gt; qui forment un syst&#232;me robuste &lt;strong&gt;plus strict et plus fiable&lt;/strong&gt; que celui fourni par LlamaIndex, et adapt&#233; &#224; une architecture modulaire, multi&#8209;thread et multiprocess. &lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h2&gt;Introduction : pourquoi un Singleton global d&#233;di&#233; ?&lt;/h2&gt;
&lt;p&gt;Dans une architecture utilisant LlamaIndex, la gestion des mod&#232;les (LLM, embeddings, tokenizer, versions) repose sur des m&#233;canismes internes du framework.
Ces m&#233;canismes fonctionnent correctement dans des cas simples, mais pr&#233;sentent plusieurs limites structurelles lorsqu'on construit une application :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;modulaire,&lt;/li&gt;
&lt;li&gt;multi&#8209;thread,&lt;/li&gt;
&lt;li&gt;multi&#8209;process (ex. plusieurs workers uvicorn/gunicorn),&lt;/li&gt;
&lt;li&gt;ou compos&#233;e de plusieurs modules ind&#233;pendants devant partager des mod&#232;les identiques.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le &#8220;singleton&#8221; interne de LlamaIndex n'est ni strict, ni stable, et peut &#234;tre r&#233;initialis&#233; ou modifi&#233; de mani&#232;re implicite selon l'ordre des imports, les contextes d'ex&#233;cution ou les workers.
Cela conduit &#224; des comportements non d&#233;terministes, difficiles &#224; diagnostiquer, et parfois dangereux (mod&#232;les diff&#233;rents selon les modules ou les workers).
Pour stabiliser l'ensemble, il est n&#233;cessaire d'introduire un singleton global explicite, contr&#244;l&#233;, verrouill&#233;, tra&#231;able et idempotent : c'est le r&#244;le de &lt;code&gt;AppSettings&lt;/code&gt; et &lt;code&gt;AppSettingsManager&lt;/code&gt; qui forment un syst&#232;me robuste &lt;strong&gt;plus strict et plus fiable&lt;/strong&gt; que celui fourni par LlamaIndex, et adapt&#233; &#224; une architecture modulaire, multi&#8209;thread et multiprocess.&lt;/p&gt;
&lt;p&gt;Ce texte documente :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;le &lt;strong&gt;principe du Singleton global&lt;/strong&gt; utilis&#233; dans nos applications d'IA, &lt;/li&gt;
&lt;li&gt;en quoi il &lt;strong&gt;diff&#232;re du &#8220;singleton&#8221; de LlamaIndex&lt;/strong&gt;, &lt;/li&gt;
&lt;li&gt;la structure et le r&#244;le de &lt;strong&gt;AppSettings&lt;/strong&gt;, &lt;/li&gt;
&lt;li&gt;la logique et les responsabilit&#233;s de &lt;strong&gt;AppSettingsManager&lt;/strong&gt;, &lt;/li&gt;
&lt;li&gt;les m&#233;canismes d'initialisation, de verrouillage et de tra&#231;age.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;1. Principe g&#233;n&#233;ral&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;AppSettings&lt;/code&gt; est un &lt;strong&gt;singleton global&lt;/strong&gt; destin&#233; &#224; contenir les objets critiques de l'application :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;le mod&#232;le LLM,&lt;/li&gt;
&lt;li&gt;le mod&#232;le d'embedding,&lt;/li&gt;
&lt;li&gt;le tokenizer,&lt;/li&gt;
&lt;li&gt;les versions associ&#233;es.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ce singleton est con&#231;u pour &#234;tre :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;strong&gt;unique&lt;/strong&gt; dans le processus,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;initialis&#233; une seule fois&lt;/strong&gt;,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;verrouill&#233;&lt;/strong&gt; apr&#232;s initialisation,&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;idempotent&lt;/strong&gt; (les appels suivants ne modifient rien),&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;tra&#231;able&lt;/strong&gt; (on sait qui a initialis&#233; en premier).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ce m&#233;canisme garantit que &lt;strong&gt;toutes les parties de l'application utilisent les m&#234;mes objets&lt;/strong&gt;, sans risque de divergence ou de r&#233;initialisation accidentelle.&lt;/p&gt;
&lt;h2&gt;2. Diff&#233;rence avec le &#8220;singleton&#8221; de LlamaIndex&lt;/h2&gt;
&lt;p&gt;LlamaIndex utilise un m&#233;canisme interne d'initialisation (souvent via &lt;code&gt;Settings&lt;/code&gt; ou des loaders) qui :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;n'est &lt;strong&gt;pas global &#224; l'application&lt;/strong&gt;, mais local au framework,&lt;/li&gt;
&lt;li&gt;peut &#234;tre r&#233;initialis&#233; selon les contextes,&lt;/li&gt;
&lt;li&gt;n'est pas con&#231;u pour &#234;tre partag&#233; entre plusieurs modules ind&#233;pendants,&lt;/li&gt;
&lt;li&gt;ne fournit pas de verrou multi&#8209;thread ou multi&#8209;process,&lt;/li&gt;
&lt;li&gt;ne trace pas l'origine de l'initialisation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;En r&#233;sum&#233; :&lt;/p&gt;&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Aspect&lt;/td&gt;
&lt;td&gt;Notre AppSettings&lt;/td&gt;
&lt;td&gt;LlamaIndex Settings&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;Port&#233;e&lt;/td&gt;
&lt;td&gt;Globale &#224; l'application&lt;/td&gt;
&lt;td&gt;Locale au framework&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Initialisation&lt;/td&gt;
&lt;td&gt;Unique, verrouill&#233;e&lt;/td&gt;
&lt;td&gt;R&#233;initialisable&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;Idempotence&lt;/td&gt;
&lt;td&gt;Oui&lt;/td&gt;
&lt;td&gt;Non garanti&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Tra&#231;age&lt;/td&gt;
&lt;td&gt;Oui (stack + timestamp)&lt;/td&gt;
&lt;td&gt;Non&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;Multi&#8209;thread&lt;/td&gt;
&lt;td&gt;Prot&#233;g&#233;&lt;/td&gt;
&lt;td&gt;Non&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;Multi&#8209;process&lt;/td&gt;
&lt;td&gt;Prot&#233;g&#233; (file lock)&lt;/td&gt;
&lt;td&gt;Non&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Notre syst&#232;me est donc &lt;strong&gt;plus strict, plus robuste et plus adapt&#233; &#224; une application multi&#8209;modules&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;3. Structure de AppSettings&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;AppSettings&lt;/code&gt; est un &lt;code&gt;BaseModel&lt;/code&gt; Pydantic contenant les objets critiques :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;llm: Optional[Any]
embed_model: Optional[Any]
tokenizer: Optional[Any]
versions: Optional[Dict[str, Any]]
locked: bool
initialized_by: Optional[str]
initialized_at: Optional[float]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Caract&#233;ristiques :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;locked&lt;/code&gt; emp&#234;che toute modification apr&#232;s initialisation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;initialized_by&lt;/code&gt; contient la stack trace du premier appel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;initialized_at&lt;/code&gt; contient le timestamp d'initialisation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;extra = &#034;forbid&#034;&lt;/code&gt; emp&#234;che l'ajout d'attributs fant&#244;mes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;validate_assignment = True&lt;/code&gt; garantit un comportement fail&#8209;closed.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;4. R&#244;le de AppSettingsManager&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;AppSettingsManager&lt;/code&gt; est le &lt;strong&gt;seul point d'entr&#233;e&lt;/strong&gt; pour modifier ou initialiser &lt;code&gt;AppSettings&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Il fournit :&lt;/p&gt;
&lt;h3&gt;4.1. &lt;code&gt;load_models()&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Charge les objets critiques.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Capture la stack trace du premier appel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Capture le timestamp.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Valide les objets.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Verrouille l'&#233;tat.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Est &lt;strong&gt;idempotent&lt;/strong&gt; : si d&#233;j&#224; initialis&#233;, ne fait rien.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.2. &lt;code&gt;validate()&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;V&#233;rifie la pr&#233;sence de &lt;code&gt;llm&lt;/code&gt;, &lt;code&gt;embed_model&lt;/code&gt;, &lt;code&gt;tokenizer&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Comporte un comportement fail&#8209;closed.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.3. &lt;code&gt;lock()&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Marque l'&#233;tat comme immuable.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.4. &lt;code&gt;describe()&lt;/code&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Retourne un dictionnaire d'introspection complet.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;5. S&#233;curit&#233; multi&#8209;thread et multi&#8209;process&lt;/h2&gt;
&lt;p&gt;L'initialisation est prot&#233;g&#233;e par deux verrous :&lt;/p&gt;
&lt;h3&gt;5.1. Verrou thread&#8209;safe&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;_thread_lock = threading.Lock()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Emp&#234;che deux threads du m&#234;me processus d'initialiser simultan&#233;ment.&lt;/p&gt;
&lt;h3&gt;5.2. Verrou multi&#8209;process (file lock)&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;_process_lock = FileLock(&#034;/tmp/appsettings_init.lock&#034;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Emp&#234;che deux processus (ex. plusieurs workers uvicorn/gunicorn) d'initialiser simultan&#233;ment.&lt;/p&gt;
&lt;p&gt;Ce m&#233;canisme garantit une &lt;strong&gt;initialisation unique&lt;/strong&gt;, m&#234;me dans un environnement multi&#8209;workers.&lt;/p&gt;
&lt;h2&gt;6. Cycle de vie complet&lt;/h2&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Une application appelle &lt;code&gt;load_models()&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le verrou multi&#8209;process est acquis.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le verrou multi&#8209;thread est acquis.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Si &lt;code&gt;locked == True&lt;/code&gt; &#8594; rien n'est fait.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sinon :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;stack trace enregistr&#233;e,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;timestamp enregistr&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;objets charg&#233;s,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;validation stricte,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;verrouillage.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Les appels suivants sont silencieusement ignor&#233;s.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;dl class='spip_document_27 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/diagramme_de_sequence_app_settings.png' class=&#034;mediabox&#034; title=&#034;Diagramme de s&#233;quence&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH334/diagramme_de_sequence_app_settings-3ce1a.png?1776303656' width='500' height='334' alt=&#034;PNG - 303.7&#160;ko&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-27 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;Diagramme de s&#233;quence &lt;/a&gt; &lt;/dt&gt; &lt;dd class='crayon document-descriptif-27 spip_doc_descriptif' style='width:350px;'&gt;Ce diagramme illustre le processus par lequel l'application obtient le singleton AppSettings pour acc&#233;der aux mod&#232;les dont elle a besoin
&lt;/dd&gt; &lt;/dl&gt;
&lt;h2&gt;7. Avantages de cette architecture&lt;/h2&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Initialisation unique garantie.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Protection contre les r&#233;initialisations accidentelles.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;S&#233;curit&#233; multi&#8209;thread et multi&#8209;process.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Tra&#231;abilit&#233; compl&#232;te.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Idempotence.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Isolation claire entre :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;le stockage global&lt;/strong&gt; (&lt;code&gt;AppSettings&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;la logique m&#233;tier&lt;/strong&gt; (&lt;code&gt;AppSettingsManager&lt;/code&gt;)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;les configurateurs externes&lt;/strong&gt; (ex. &lt;code&gt;LlamaConfigurator&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;8. R&#233;sum&#233;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;AppSettings&lt;/code&gt; et &lt;code&gt;AppSettingsManager&lt;/code&gt; forment un syst&#232;me robuste permettant :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;de centraliser les objets critiques,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;de garantir une initialisation unique,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;de s&#233;curiser l'acc&#232;s concurrent,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;de tracer l'origine de l'initialisation,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;de fournir une introspection compl&#232;te.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ce m&#233;canisme est &lt;strong&gt;plus strict et plus fiable&lt;/strong&gt; que celui fourni par LlamaIndex, et il est adapt&#233; &#224; une architecture modulaire, multi&#8209;thread et multiprocess.&lt;/p&gt;
&lt;h1&gt;9.Usage&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;En version v1xx :&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; react.&lt;span style=&#034;color: black;&#034;&gt;modules&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;tools&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;config_llama_mistral&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; LlamaConfigurator&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; get_app_settings&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;...&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Initialize application settings with LlamaIndex objects : LLM, embeddings etc.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;os&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;environ&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;'MISTRAL_LLM_API_KEY'&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; llmapikey&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; LlamaConfigurator.&lt;span style=&#034;color: black;&#034;&gt;load_models&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;...&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;embed_model&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/98745a32a5d73b6c3150b0e980f8be5f.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;En version v2xx :&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Architecture v200 :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ModelsConfigurator &#8594; charge les mod&#232;les purs (HF/ST, MistralAI, tokenizer) &#8594; stocke dans AppSettings &#8595; AppSettings &#8595; LlamaIndexAdapter &#8594; convertit en objets LlamaIndex &#8595; RAGEngine v200&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Avec la nouvelle architecture :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;ModelsConfigurator charge uniquement les mod&#232;les applicatifs (embedding HF/ST, LLM MistralAI, tokenizer)&lt;/li&gt;
&lt;li&gt;LlamaIndexAdapter convertit ces mod&#232;les en objets LlamaIndex si et seulement l'application en a besoin. besoin.&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; react_v2.&lt;span style=&#034;color: black;&#034;&gt;modules&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;tools&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;config_models&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; ModelsConfigurator&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; react_v2.&lt;span style=&#034;color: black;&#034;&gt;modules&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;tools&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;llamaindex_adapter&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; LlamaIndexAdapter&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; get_app_settings&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# 1. Charger les mod&#232;les applicatifs&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #dc143c;&#034;&gt;os&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;environ&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;MISTRAL_LLM_API_KEY&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; llmapikey&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;ModelsConfigurator.&lt;span style=&#034;color: black;&#034;&gt;load_models&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# 2. R&#233;cup&#233;rer les objets applicatifs&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# 3. Convertir en objets LlamaIndex si n&#233;cessaire&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;llm &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;self&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;embed_model &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; LlamaIndexAdapter.&lt;span style=&#034;color: black;&#034;&gt;get_llamaindex_embedding&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/f7b97c5e4e6c7070b0442764ce5e8698.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div &lt;div class='rss_ps'&gt;&lt;h3 class=&#034;spip&#034;&gt;La classe AppSettings&lt;/h3&gt;&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# app_settings.py&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# coding: utf8&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;''' &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Classe AppSettings&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Remplace le singleton 'Settings' de LlamaIndex. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Le singleton de LlamaIndex n'est pas stable :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;- il est r&#233;initialis&#233; par certains modules internes lors d'imports tardifs,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;- il est mutable et non verrouill&#233;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;- il est globalement partag&#233; par tout LlamaIndex, et peut &#234;tre &#233;cras&#233; silencieusement par des appels internes,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;etc.. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Auteur : &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; B.Degoy bertrand@degoy.com &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;copyright (c) 2026 B.Degoy&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;licence : all rights reserved&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;'''&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; functools &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; lru_cache&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; pydantic &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; BaseModel&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Field&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; typing &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; Any&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Optional&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Dict&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; AppSettings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;BaseModel&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;Singleton global contenant les objets critiques de l'application.&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; llm: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Any&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; embed_model: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Any&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; tokenizer: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Any&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; versions: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;Dict&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; Any&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; locked: &lt;span style=&#034;color: #008000;&#034;&gt;bool&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; Field&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;default&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;False&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; exclude&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; initialized_by: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;str&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; Field&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;default&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; exclude&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;False&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; initialized_at: Optional&lt;span style=&#034;color: black;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;float&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; Config:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; arbitrary_types_allowed &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; validate_assignment &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# fail-closed si mauvais type&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; extra &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;forbid&#034;&lt;/span&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# pas d'attributs fant&#244;mes&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;lru_cache&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;maxsize&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #ff4500;&#034;&gt;1&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; AppSettings:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; AppSettings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/7b15ae058e06ddd96ac7144a6744b67c.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;La classe AppSettingsManager&lt;/h3&gt;&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_python code&#034;&gt;&lt;div class=&#034;python&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# app_settings_manager.py&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# coding: utf8&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;''' &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Classe AppSettingsManager&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;thread-safe, multiprocess-safe&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;Auteur : &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt; B.Degoy bertrand@degoy.com &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;copyright (c) 2026 B.Degoy&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;licence : all rights reserved&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;'''&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;traceback&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;time&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; pydantic &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; ValidationError&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; commons.&lt;span style=&#034;color: black;&#034;&gt;settings&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;app_settings&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; get_app_settings &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;#j&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# verrous multi-processus&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;from&lt;/span&gt; filelock &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; FileLock&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;import&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;threading&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Verrou inter-processus&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;_process_lock &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; FileLock&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;/tmp/appsettings_init.lock&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# r&#233;pertoire standard pour les verrous inter-processus&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Verrou intra-processus (threads)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;_thread_lock &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;threading&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;Lock&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;class&lt;/span&gt; AppSettingsManager:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; load_models&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;llm&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; embed_model&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; tokenizer&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt; versions&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;with&lt;/span&gt; _process_lock: &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# verrou multi-process &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;with&lt;/span&gt; _thread_lock: &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# verrou thread-safe&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# D&#233;j&#224; charg&#233; et verrouill&#233; : OK, on ne fait rien&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;locked&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Optionnel : v&#233;rifier la coh&#233;rence&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;app.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;and&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# idempotent, silencieux&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;RuntimeError&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[AppSettingsManager] AppSettings is locked but incomplete.&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# Initialisation au premier appel :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# capturer la stack du premier appel&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;initialized_by&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;join&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #dc143c;&#034;&gt;traceback&lt;/span&gt;.&lt;span style=&#034;color: black;&#034;&gt;format_stack&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;limit&lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt;&lt;span style=&#034;color: #ff4500;&#034;&gt;10&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;initialized_at&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #dc143c;&#034;&gt;time&lt;/span&gt;.&lt;span style=&#034;color: #dc143c;&#034;&gt;time&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #808080; font-style: italic;&#034;&gt;# on charge&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; llm&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; embed_model&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; tokenizer&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;versions&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; versions &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;or&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; AppSettingsManager.&lt;span style=&#034;color: black;&#034;&gt;validate&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; AppSettingsManager.&lt;span style=&#034;color: black;&#034;&gt;lock&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; validate&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;Validation stricte fail-closed.&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; ValidationError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[AppSettingsManager] Missing LLM in AppSettings&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; ValidationError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[AppSettingsManager] Missing embed_model in AppSettings&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;is&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;raise&lt;/span&gt; ValidationError&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;[AppSettingsManager] Missing tokenizer in AppSettings&#034;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; lock&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;Emp&#234;che toute modification ult&#233;rieure.&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app.&lt;span style=&#034;color: black;&#034;&gt;locked&lt;/span&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;True&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #66cc66;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #008000;&#034;&gt;staticmethod&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;def&lt;/span&gt; describe&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt; -&lt;span style=&#034;color: #66cc66;&#034;&gt;&gt;&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;dict&lt;/span&gt;:&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;&#034;&#034;Introspection compl&#232;te pour debug.&#034;&#034;&#034;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; app &lt;span style=&#034;color: #66cc66;&#034;&gt;=&lt;/span&gt; get_app_settings&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: black;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;llm&#034;&lt;/span&gt;: &lt;span style=&#034;color: #008000;&#034;&gt;type&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;app.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.__name__ &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;llm&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;embed_model&#034;&lt;/span&gt;: &lt;span style=&#034;color: #008000;&#034;&gt;type&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;app.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.__name__ &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;embed_model&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;tokenizer&#034;&lt;/span&gt;: &lt;span style=&#034;color: #008000;&#034;&gt;type&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#40;&lt;/span&gt;app.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt;&lt;span style=&#034;color: black;&#034;&gt;&amp;#41;&lt;/span&gt;.__name__ &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;if&lt;/span&gt; app.&lt;span style=&#034;color: black;&#034;&gt;tokenizer&lt;/span&gt; &lt;span style=&#034;color: #ff7700;font-weight:bold;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #008000;&#034;&gt;None&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;versions&#034;&lt;/span&gt;: app.&lt;span style=&#034;color: black;&#034;&gt;versions&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;locked&#034;&lt;/span&gt;: app.&lt;span style=&#034;color: black;&#034;&gt;locked&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;initialized_by&#034;&lt;/span&gt;: app.&lt;span style=&#034;color: black;&#034;&gt;initialized_by&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #483d8b;&#034;&gt;&#034;initialized_at&#034;&lt;/span&gt;: app.&lt;span style=&#034;color: black;&#034;&gt;initialized_at&lt;/span&gt;&lt;span style=&#034;color: #66cc66;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: black;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://ia.dnc.global/local/cache-code/29d9d5b8acafbdfcefaf7b6b20dc3ae5.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Chat Engine Mistral</title>
		<link>https://ia.dnc.global/Chat-Engine-Mistral.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/Chat-Engine-Mistral.html</guid>
		<dc:date>2026-03-09T13:14:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Avec les r&#233;glages adopt&#233;s, le ChatEngine est de type C3 : CondensePlusContextChatEngine. &lt;br class='autobr' /&gt;
La classe est : &lt;class 'llama_index.core.chat_engine.condense_plus_context.CondensePlusContextChatEngine'&gt; &lt;br class='autobr' /&gt;
Il en r&#233;sulte l'API suivante : M&#233;thodes par cat&#233;gorie fonctionnelle 1. M&#233;thodes publiques (API officielle) chat(prompt) Appel synchrone. Retourne une r&#233;ponse compl&#232;te (pas de streaming). Utilise la condensation + r&#233;cup&#233;ration de contexte + synth&#232;se. stream_chat(message) Version streaming de (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-Aspects-techniques-.html" rel="directory"&gt;Aspects techniques&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_texte'&gt;&lt;p&gt;Avec les r&#233;glages adopt&#233;s, le ChatEngine est de type &lt;strong&gt;C3 : CondensePlusContextChatEngine&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;La classe est :
&lt;class 'llama_index.core.chat_engine.condense_plus_context.CondensePlusContextChatEngine'&gt;&lt;/p&gt;
&lt;p&gt;Il en r&#233;sulte l'API suivante : &lt;/p&gt;
&lt;h1&gt;M&#233;thodes par &lt;strong&gt;cat&#233;gorie fonctionnelle&lt;/strong&gt;&lt;/h1&gt;
&lt;hr /&gt;
&lt;h2&gt;1. &lt;strong&gt;M&#233;thodes publiques (API officielle)&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;chat(prompt)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Appel synchrone.&lt;/li&gt;
&lt;li&gt;Retourne une r&#233;ponse compl&#232;te (pas de streaming).&lt;/li&gt;
&lt;li&gt;Utilise la condensation + r&#233;cup&#233;ration de contexte + synth&#232;se.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;stream_chat(message)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version streaming de &lt;code&gt;chat()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Retourne un &lt;code&gt;ChatResponse&lt;/code&gt; avec &lt;code&gt;response_gen&lt;/code&gt; (g&#233;n&#233;rateur de tokens).&lt;/li&gt;
&lt;li&gt;C'est celle que tu utilises.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;achat(prompt)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version &lt;strong&gt;async&lt;/strong&gt; de &lt;code&gt;chat()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;astream_chat(message)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version &lt;strong&gt;async&lt;/strong&gt; de &lt;code&gt;stream_chat()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;chat_history&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Liste interne des messages &#233;chang&#233;s.&lt;/li&gt;
&lt;li&gt;Utilis&#233;e pour la condensation (C3).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;reset()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Vide l'historique du chat.&lt;/li&gt;
&lt;li&gt;R&#233;initialise l'&#233;tat interne.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ne ferme aucun stream&lt;/strong&gt; (important).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;from_defaults(...)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Constructeur de convenance.&lt;/li&gt;
&lt;li&gt;Permet de cr&#233;er un CondensePlusContextChatEngine avec des param&#232;tres par d&#233;faut.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;chat_repl()&lt;/code&gt; / &lt;code&gt;streaming_chat_repl()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Interfaces REPL (console).&lt;/li&gt;
&lt;li&gt;Pas utiles dans ton architecture Streamlit.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;2. &lt;strong&gt;M&#233;thodes internes li&#233;es &#224; la condensation (C3)&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;C'est le c&#339;ur du moteur.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_condense_question()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Prend la derni&#232;re question utilisateur.&lt;/li&gt;
&lt;li&gt;Condense en une question autonome.&lt;/li&gt;
&lt;li&gt;Utilise &lt;code&gt;_condense_prompt_template&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_acondense_question()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version async.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_skip_condense&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Bool&#233;en interne.&lt;/li&gt;
&lt;li&gt;Permet de bypasser la condensation (rare).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_condense_prompt_template&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Prompt utilis&#233; pour la condensation.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;3. &lt;strong&gt;M&#233;thodes internes li&#233;es &#224; la r&#233;cup&#233;ration de contexte&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_get_nodes(query)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Appelle le retriever.&lt;/li&gt;
&lt;li&gt;Retourne les n&#339;uds pertinents.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_aget_nodes(query)&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version async.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_retriever&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;L'objet retriever (vector store, BM25, hybrid&#8230;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_node_postprocessors&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Liste de post&#8209;processeurs appliqu&#233;s aux n&#339;uds (rerankers, filtres&#8230;).&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;4. &lt;strong&gt;M&#233;thodes internes li&#233;es &#224; la synth&#232;se de r&#233;ponse&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_run_c3()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Pipeline complet :&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;condensation &lt;/li&gt;
&lt;li&gt;r&#233;cup&#233;ration &lt;/li&gt;
&lt;li&gt;synth&#232;se &lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_arun_c3()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Version async.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_get_response_synthesizer()&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Retourne l'objet responsable de la g&#233;n&#233;ration finale.&lt;/li&gt;
&lt;li&gt;Souvent un &lt;code&gt;ResponseSynthesizer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;5. &lt;strong&gt;M&#233;thodes internes li&#233;es au LLM&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_llm&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;L'instance du LLM (OpenAI, Ollama, Azure, etc.).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_system_prompt&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Prompt syst&#232;me inject&#233; dans la conversation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_token_counter&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Compteur interne pour mesurer les tokens consomm&#233;s.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;_verbose&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Active les logs d&#233;taill&#233;s.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;6. &lt;strong&gt;M&#233;thodes h&#233;rit&#233;es / utilitaires&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;callback_manager&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Gestion des callbacks (events, logs, instrumentation).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;__abstractmethods__&lt;/code&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Indique que la classe h&#233;rite d'une ABC.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;&lt;code&gt;__dict__&lt;/code&gt;, &lt;code&gt;__repr__&lt;/code&gt;, etc.&lt;/strong&gt;&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;M&#233;thodes Python standard.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h2&gt;R&#233;sum&#233;&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;M&#233;thode&lt;/th&gt;
&lt;th&gt;R&#244;le&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;chat()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;ponse compl&#232;te&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;stream_chat()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Streaming&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;achat()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Async&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;astream_chat()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Async streaming&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;reset()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;initialise l'historique&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;_condense_question()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Condensation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;_get_nodes()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;R&#233;cup&#233;ration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;_run_c3()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pipeline complet&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;_llm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;LLM utilis&#233;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;chat_history&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Historique interne&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr /&gt;
&lt;h1&gt;Le pipeline C3&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;CondensePlusContextChatEngine&lt;/code&gt; applique un pipeline en 3 phases :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;strong&gt;Condense&lt;/strong&gt; &#8594; transformer l'entr&#233;e utilisateur en une question autonome &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Context&lt;/strong&gt; &#8594; r&#233;cup&#233;rer les n&#339;uds pertinents via le retriever &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chat&lt;/strong&gt; &#8594; synth&#233;tiser une r&#233;ponse avec le LLM (streaming ou non)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Ce pipeline est impl&#233;ment&#233; dans &lt;code&gt;_run_c3()&lt;/code&gt; et &lt;code&gt;_arun_c3()&lt;/code&gt;.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;&#201;tape 1 &#8212; Condensation de la question&lt;/h1&gt;
&lt;p&gt;M&#233;thode interne : &lt;strong&gt;&lt;code&gt;_condense_question()&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Objectif :&lt;br /&gt;
Transformer la question utilisateur + historique en une question autonome, courte, optimis&#233;e pour le retriever.&lt;/p&gt;
&lt;p&gt;Processus :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;Le moteur regarde &lt;code&gt;chat_history&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Il prend le dernier message utilisateur &lt;/li&gt;
&lt;li&gt;Il applique &lt;code&gt;_condense_prompt_template&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Il appelle le LLM (&lt;code&gt;_llm&lt;/code&gt;) pour produire une version condens&#233;e &lt;/li&gt;
&lt;li&gt;Il retourne un texte propre, sans bruit conversationnel&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Si &lt;code&gt;_skip_condense=True&lt;/code&gt;, cette &#233;tape est saut&#233;e.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;&#201;tape 2 &#8212; R&#233;cup&#233;ration du contexte&lt;/h1&gt;
&lt;p&gt;M&#233;thode interne : &lt;strong&gt;&lt;code&gt;_get_nodes()&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Objectif :&lt;br /&gt;
R&#233;cup&#233;rer les documents pertinents pour r&#233;pondre &#224; la question condens&#233;e.&lt;/p&gt;
&lt;p&gt;Processus :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;Le moteur appelle &lt;code&gt;_retriever.retrieve(condensed_question)&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Le retriever renvoie une liste de &lt;code&gt;NodeWithScore&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Le moteur applique les post&#8209;processeurs (&lt;code&gt;_node_postprocessors&lt;/code&gt;) &lt;/li&gt;
&lt;li&gt;Le moteur obtient une liste finale de n&#339;uds pertinents&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;C'est ici que vector store, BM25, hybrid search, etc. interviennent.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;&#201;tape 3 &#8212; Synth&#232;se de la r&#233;ponse&lt;/h1&gt;
&lt;p&gt;M&#233;thode interne : &lt;strong&gt;&lt;code&gt;_get_response_synthesizer()&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Objectif :&lt;br /&gt;
G&#233;n&#233;rer la r&#233;ponse finale &#224; partir :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;de la question condens&#233;e &lt;/li&gt;
&lt;li&gt;des n&#339;uds r&#233;cup&#233;r&#233;s &lt;/li&gt;
&lt;li&gt;du prompt syst&#232;me &lt;/li&gt;
&lt;li&gt;de l'historique &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Processus :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;Le moteur construit un prompt complet (system + context + question) &lt;/li&gt;
&lt;li&gt;Il appelle le LLM via le &lt;code&gt;ResponseSynthesizer&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Si on utilise &lt;code&gt;stream_chat()&lt;/code&gt; :&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;le LLM est appel&#233; en mode streaming &lt;/li&gt;
&lt;li&gt;un g&#233;n&#233;rateur Python est cr&#233;&#233; (&lt;code&gt;response.response_gen&lt;/code&gt;) &lt;/li&gt;
&lt;li&gt;chaque token est yield&#233; au fur et &#224; mesure &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Le moteur met &#224; jour &lt;code&gt;chat_history&lt;/code&gt; avec :&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;la question condens&#233;e &lt;/li&gt;
&lt;li&gt;la r&#233;ponse finale &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr /&gt;
&lt;h1&gt;Ce qui se passe EXACTEMENT dans &lt;code&gt;stream_chat()&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;Voici la s&#233;quence interne r&#233;elle :&lt;/p&gt;
&lt;h3&gt;1. Normalisation de l'entr&#233;e&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;stream_chat()&lt;/code&gt; accepte :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;un dict &lt;/li&gt;
&lt;li&gt;un &lt;code&gt;ChatMessage&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;un &lt;code&gt;QueryBundle&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il convertit tout en un &lt;code&gt;ChatMessage&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;2. Ajout du message utilisateur dans &lt;code&gt;chat_history&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Le moteur stocke le message brut.&lt;/p&gt;
&lt;h3&gt;3. Appel &#224; &lt;code&gt;_run_c3()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;C'est le pipeline complet :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;condensed = _condense_question()
nodes = _get_nodes(condensed)
response = synthesizer.synthesize(condensed, nodes, streaming=True)&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;4. Construction d'un &lt;code&gt;ChatResponse&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Ce n'est pas un simple objet :&lt;br /&gt;
c'est un wrapper contenant :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;code&gt;response_gen&lt;/code&gt; &#8594; le g&#233;n&#233;rateur de tokens &lt;/li&gt;
&lt;li&gt;&lt;code&gt;response&lt;/code&gt; &#8594; la r&#233;ponse compl&#232;te (remplie &#224; la fin) &lt;/li&gt;
&lt;li&gt;&lt;code&gt;metadata&lt;/code&gt; &#8594; infos sur les n&#339;uds, tokens, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;5. Retour du &lt;code&gt;ChatResponse&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Et c'est l&#224; que &lt;strong&gt;tu dois consommer le g&#233;n&#233;rateur&lt;/strong&gt;.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;Le point critique : le g&#233;n&#233;rateur&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;response.response_gen&lt;/code&gt; est un &lt;strong&gt;g&#233;n&#233;rateur Python&lt;/strong&gt; qui encapsule :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;un flux HTTP (OpenAI, Ollama, Azure&#8230;) &lt;/li&gt;
&lt;li&gt;un pipe interne &lt;/li&gt;
&lt;li&gt;un buffer de tokens &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Et &lt;strong&gt;il n'est jamais ferm&#233; automatiquement&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Cela peut provoquer l'erreur :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;OSError: [Errno 24] Too many open files&lt;/code&gt;&lt;/pre&gt;
&lt;hr /&gt;
&lt;h1&gt;Pourquoi &lt;code&gt;reset()&lt;/code&gt; ne ferme rien&lt;/h1&gt;
&lt;p&gt;Parce que :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;&lt;code&gt;reset()&lt;/code&gt; vide &lt;code&gt;chat_history&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;mais ne touche pas aux g&#233;n&#233;rateurs &lt;/li&gt;
&lt;li&gt;ni aux connexions HTTP &lt;/li&gt;
&lt;li&gt;ni aux file descriptors &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Donc &lt;strong&gt;aucun impact sur les fuites&lt;/strong&gt;.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;Comment terminer le pipeline proprement&lt;/h1&gt;
&lt;pre&gt;&lt;code class=&#034;language-python&#034;&gt;gen = response.response_gen
try: for token in gen: ...
finally: gen.close()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;C'est &lt;strong&gt;la seule&lt;/strong&gt; mani&#232;re de lib&#233;rer les ressources.&lt;/p&gt;
&lt;hr /&gt;
&lt;h1&gt;R&#233;sum&#233;&lt;/h1&gt;
&lt;p&gt;Voici le pipeline interne complet :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;stream_chat() &#8595;
normalisation du message &#8595;
chat_history.append(user_message) &#8595;
_run_c3() &#8595;
_condense_question() &#8595;
_get_nodes() &#8595;
_get_response_synthesizer() &#8595;
LLM(streaming=True) &#8595;
ChatResponse(response_gen=generator) &#8595;
return ChatResponse&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>ReActEngine v1 : int&#233;gration dans le front end</title>
		<link>https://ia.dnc.global/ReActEngine-v1-integration-dans-le-front-end.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/ReActEngine-v1-integration-dans-le-front-end.html</guid>
		<dc:date>2026-02-12T09:30:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;Cette article d&#233;crit comment ReActEngine v1 s'int&#232;gre dans le front&#8209;end Streamlit chatitego_v128, et clarifie la s&#233;paration des responsabilit&#233;s entre les deux couches. Il faut consid&#233;rer que le moteur est stateless, tandis que le front&#8209;end assure toute la persistance (index, historique, th&#232;me, param&#232;tres). &lt;br class='autobr' /&gt; ## 1. Architecture g&#233;n&#233;rale &lt;br class='autobr' /&gt;
### ReActEngine v1 Ne conserve aucun &#233;tat interne. Ne stocke ni index, ni historique, ni th&#232;me. Ne g&#232;re pas la session Streamlit. Ne persiste aucune donn&#233;e. Re&#231;oit &#224; (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-ReActEngine-v1-.html" rel="directory"&gt;ReActEngine v1&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Cette article d&#233;crit comment ReActEngine v1 s'int&#232;gre dans le front&#8209;end Streamlit chatitego_v128, et clarifie la s&#233;paration des responsabilit&#233;s entre les deux couches. Il faut consid&#233;rer que le moteur est stateless, tandis que le front&#8209;end assure toute la persistance (index, historique, th&#232;me, param&#232;tres).&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;hr /&gt;
&lt;h2&gt;1. Architecture g&#233;n&#233;rale&lt;/h2&gt;
&lt;h3&gt;ReActEngine v1&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Ne conserve aucun &#233;tat interne.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ne stocke ni index, ni historique, ni th&#232;me.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ne g&#232;re pas la session Streamlit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ne persiste aucune donn&#233;e.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Re&#231;oit &#224; chaque appel :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;le th&#232;me,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'index,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la langue,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;le niveau de d&#233;tail,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;le jeton de s&#233;curit&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'historique de conversation.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Il ex&#233;cute ensuite la logique ReAct et renvoie un flux de blocs (Thought, Action, Observation, Answer).&lt;/p&gt;
&lt;h3&gt;Front&#8209;end Streamlit (chatitego_v128)&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Charge et persiste l'index du th&#232;me.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Charge et persiste l'historique de conversation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;G&#232;re les cookies (th&#232;me, historique).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;G&#232;re les param&#232;tres du th&#232;me.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Construit et maintient l'&#233;tat de session (&lt;code&gt;st.session_state&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;R&#233;injecte l'&#233;tat dans ReActEngine &#224; chaque requ&#234;te.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;G&#232;re l'affichage du streaming (placeholders, Markdown, HTML).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Extrait la r&#233;ponse finale et la sauvegarde.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. Cycle de vie d'une session&lt;/h2&gt;
&lt;dl class='spip_document_48 spip_documents'&gt; &lt;dt&gt; &lt;a href='https://ia.dnc.global/IMG/png/react_agent_workflow-2026-04-28-052909.png' class=&#034;mediabox&#034; title=&#034;Int&#233;gration de ReActEngine v1 : diagramme des s&#233;quences&#034; &gt; &lt;img src='https://ia.dnc.global/local/cache-vignettes/L500xH515/react_agent_workflow-2026-04-28-052909-a23bb.png?1777363779' width='500' height='515' alt=&#034;PNG - 1.5&#160;Mo&#034; /&gt; &lt;/a&gt; &lt;/dt&gt; &lt;dt class='crayon document-titre-48 spip_doc_titre' style='width:350px;'&gt; &lt;a href='https://ia.dnc.global/doc'&gt;Int&#233;gration de ReActEngine v1 : diagramme des s&#233;quences &lt;/a&gt; &lt;/dt&gt; &lt;/dl&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;Lecture du th&#232;me depuis l'URL ou les cookies.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Chargement de l'index du th&#232;me depuis le disque.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Instanciation de &lt;code&gt;ReActEngine&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Appel &#224; &lt;code&gt;start()&lt;/code&gt; avec :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;th&#232;me,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;langue,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;jeton de s&#233;curit&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;index.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Chargement de l'historique depuis les cookies.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Affichage de l'historique dans l'interface.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Lors d'un nouveau prompt :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;ajout du message utilisateur &#224; l'historique,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;passage de l'historique &#224; &lt;code&gt;set_history()&lt;/code&gt;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;appel &#224; &lt;code&gt;stream(prompt)&lt;/code&gt; pour obtenir les blocs ReAct,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;affichage progressif des blocs,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;extraction de la r&#233;ponse finale,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;sauvegarde de l'historique.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. R&#244;le exact de &lt;code&gt;start()&lt;/code&gt; dans ReActEngine v1&lt;/h2&gt;
&lt;p&gt;La m&#233;thode &lt;code&gt;start()&lt;/code&gt; est appel&#233;e &#224; chaque session Streamlit. Elle re&#231;oit :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;le th&#232;me,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;le niveau de d&#233;tail,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;le jeton de s&#233;curit&#233;,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la langue,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'index.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Comme le moteur est stateless, &lt;code&gt;start()&lt;/code&gt; ne fait qu'initialiser un contexte de travail pour l'appel courant. Aucun &#233;tat n'est conserv&#233; entre deux sessions ou deux requ&#234;tes.&lt;/p&gt;
&lt;h2&gt;4. Gestion de l'historique&lt;/h2&gt;
&lt;p&gt;Le front&#8209;end utilise :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;StreamlitCookieStore&lt;/code&gt; pour la persistance,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;HistoryStore&lt;/code&gt; pour la lecture/&#233;criture.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Avant chaque appel &#224; &lt;code&gt;stream()&lt;/code&gt;, le front&#8209;end reconstruit l'historique :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;my_react_engine.set_history(msg_copy)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Le moteur ne stocke rien : il ne fait que consommer l'historique fourni.&lt;/p&gt;
&lt;h2&gt;5. Gestion de l'index&lt;/h2&gt;
&lt;p&gt;L'index est charg&#233; une seule fois par session :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;index = thm.load_data()
st.session_state.index = index&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Puis il est pass&#233; &#224; ReActEngine via &lt;code&gt;start()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Le moteur ne conserve pas l'index entre deux appels. C'est le front&#8209;end qui le garde en m&#233;moire et le r&#233;injecte.&lt;/p&gt;
&lt;h2&gt;6. Streaming et affichage&lt;/h2&gt;
&lt;p&gt;Le front&#8209;end g&#232;re :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;la cr&#233;ation des placeholders,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'affichage des blocs Thought / Action / Observation,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;l'affichage de la r&#233;ponse finale en Markdown,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la reconstruction du texte final,&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;la sauvegarde dans l'historique.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;ReActEngine ne g&#232;re que la g&#233;n&#233;ration des blocs.&lt;/p&gt;
&lt;h2&gt;7. R&#233;sum&#233;&lt;/h2&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;
&lt;p&gt;ReActEngine v1 est stateless.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Toute la persistance est assur&#233;e par le front&#8209;end Streamlit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le front&#8209;end charge l'index, les param&#232;tres, le th&#232;me et l'historique.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le front&#8209;end r&#233;injecte l'&#233;tat dans ReActEngine via &lt;code&gt;start()&lt;/code&gt; et &lt;code&gt;set_history()&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ReActEngine ne conserve rien entre deux appels.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Le front&#8209;end g&#232;re enti&#232;rement le streaming et l'affichage.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div &lt;div class='rss_ps'&gt;&lt;hr /&gt;
&lt;h2&gt;Evolution&lt;/h2&gt;
&lt;p&gt;L'&#233;volution propos&#233;e vise &#224; d&#233;passer les limites de l'architecture actuelle, o&#249; Streamlit impose un fonctionnement stateless et un rechargement r&#233;p&#233;t&#233; des index et de l'historique, entra&#238;nant une latence inutile et un couplage fort entre l'interface et le moteur. &lt;/p&gt;
&lt;p&gt;La nouvelle approche consiste &#224; &lt;strong&gt;transformer ReActEngine en un composant stateful int&#233;gr&#233; dans un daemon local&lt;/strong&gt;, capable de charger les index en lazy&#8209;loading et de conserver l'&#233;tat utilisateur de mani&#232;re persistante. &lt;/p&gt;
&lt;p&gt;Cette s&#233;paration nette des responsabilit&#233;s permet d'obtenir un moteur plus performant, plus robuste et r&#233;ellement multi&#8209;utilisateur. En parall&#232;le, le remplacement de Streamlit par NiceGUI offre un front&#8209;end plus stable, plus r&#233;actif et mieux adapt&#233; au streaming et aux sessions persistantes, tout en conservant une int&#233;gration Python directe avec le daemon. &lt;/p&gt;
&lt;p&gt;L'ensemble aboutit &#224; une architecture plus modulaire, plus efficace et plus industrielle.&lt;/p&gt;
&lt;h3&gt;Inconv&#233;nients de la solution actuelle&lt;/h3&gt;
&lt;p&gt;La version actuelle repose sur Streamlit, qui relance le script &#224; chaque interaction et ne garantit pas la persistance des objets en m&#233;moire. L'index du th&#232;me doit &#234;tre recharg&#233; &#224; chaque session, ce qui augmente la latence et la charge CPU.
L'historique de conversation est g&#233;r&#233; c&#244;t&#233; front&#8209;end via des cookies, ce qui limite la robustesse et la capacit&#233; multi&#8209;utilisateur. ReActEngine reste stateless et d&#233;pend du front&#8209;end pour recevoir l'index, le th&#232;me et l'historique, ce qui cr&#233;e un couplage fort et emp&#234;che toute mont&#233;e en charge ou r&#233;utilisation du moteur dans d'autres contextes.&lt;/p&gt;
&lt;p&gt;L&lt;strong&gt;'objectif&lt;/strong&gt; est de rendre l'architecture plus modulaire, plus performante et plus industrielle. Il s'agit de s&#233;parer clairement le moteur ReAct de la couche d'interface, de r&#233;duire les rechargements inutiles, d'am&#233;liorer la gestion multi&#8209;utilisateur, et de permettre une persistance durable de l'&#233;tat. L'architecture doit &#233;galement permettre un front&#8209;end plus stable, plus r&#233;actif et plus flexible que Streamlit.&lt;/p&gt;
&lt;h3&gt;Transformation de ReActEngine en moteur stateful&lt;/h3&gt;
&lt;p&gt;ReActEngine doit &#234;tre int&#233;gr&#233; dans &lt;strong&gt;un composant long&#8209;living qui conserve en m&#233;moire les index des th&#232;mes et l'&#233;tat des utilisateurs&lt;/strong&gt;. L'index est charg&#233; en lazy&#8209;loading lors de la premi&#232;re utilisation d'un th&#232;me, puis conserv&#233; en RAM. L'&#233;tat utilisateur est index&#233; par la d&#233;claration 'sub' (subject) du &lt;a href=&#034;https://oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#jsonwebtokenjwt&#034; class='spip_out' rel='external'&gt;jeton d'identit&#233; JWT&lt;/a&gt; et contient l'historique et les donn&#233;es persistantes. Le moteur ne d&#233;pend plus du front&#8209;end pour recevoir l'&#233;tat : il le g&#232;re lui&#8209;m&#234;me via un gestionnaire interne. La logique ReAct reste inchang&#233;e, mais elle s'ex&#233;cute d&#233;sormais dans un environnement persistant.&lt;/p&gt;
&lt;h3&gt;Daemon local&lt;/h3&gt;
&lt;p&gt;Le moteur stateful doit &#234;tre encapsul&#233; dans &lt;strong&gt;un daemon Python local&lt;/strong&gt;, instanci&#233; une seule fois au d&#233;marrage de l'application. Ce daemon maintient :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;un cache d'index par th&#232;me,&lt;/li&gt;
&lt;li&gt;un dictionnaire d'&#233;tats utilisateur ( identifi&#233; par authentification ).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le front&#8209;end communique avec lui via des appels Python directs, sans passer par une API HTTP. Cette approche &#233;limine la latence r&#233;seau, simplifie l'architecture et permet une gestion efficace de la m&#233;moire et des sessions.&lt;/p&gt;
&lt;h3&gt;NiceGUI&lt;/h3&gt;
&lt;p&gt;NiceGUI peut remplacer avantageusement Streamlit comme front&#8209;end. Il fournit un serveur web stable, bas&#233; sur FastAPI et WebSockets, qui permet un streaming fluide des r&#233;ponses et une gestion robuste des sessions utilisateur. Il s'int&#232;gre naturellement avec un daemon local Python et permet de construire une interface moderne, r&#233;active et persistante. Le front&#8209;end devient un simple client du daemon, charg&#233; d'afficher les messages, de g&#233;rer l'authentification et de transmettre les prompts.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>RAG : Compression contextuelle</title>
		<link>https://ia.dnc.global/RAG-Compression-contextuelle.html</link>
		<guid isPermaLink="true">https://ia.dnc.global/RAG-Compression-contextuelle.html</guid>
		<dc:date>2026-02-12T08:19:12Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>Bertrand Degoy</dc:creator>



		<description>
&lt;p&gt;La contextual compression est un sujet qui est devenu central dans les RAG modernes. &lt;br class='autobr' /&gt;
C'est une technique qui permet de r&#233;duire dynamiquement - c'est &#224; dire en fonction du contexte - la quantit&#233; de texte envoy&#233;e au LLM en ne gardant que ce qui est pertinent pour la requ&#234;te. &lt;br class='autobr' /&gt; On ne renvoit pas les documents bruts, mais une version compress&#233;e, filtr&#233;e, ou r&#233;sum&#233;e, adapt&#233;e &#224; la question. &lt;br class='autobr' /&gt;
C'est un *pr&#233;&#8209;processing intelligent* du contexte. &lt;br class='autobr' /&gt;
#C'est devenu indispensable &lt;br class='autobr' /&gt;
Parce que : les fen&#234;tres de contexte (...)&lt;/p&gt;


-
&lt;a href="https://ia.dnc.global/-Architecture-et-traitements-.html" rel="directory"&gt;Architecture et traitements&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;La contextual compression est un sujet qui est devenu central dans les RAG modernes.&lt;/p&gt;
&lt;p&gt;C'est une technique qui permet de r&#233;duire dynamiquement - c'est &#224; dire en fonction du contexte - la quantit&#233; de texte envoy&#233;e au LLM en ne gardant que ce qui est pertinent pour la requ&#234;te.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;On ne renvoit pas les documents bruts, mais une version compress&#233;e, filtr&#233;e, ou r&#233;sum&#233;e, adapt&#233;e &#224; la question.&lt;/p&gt;
&lt;p&gt;C'est un &lt;em&gt;pr&#233;&#8209;processing intelligent&lt;/em&gt; du contexte.&lt;/p&gt;
&lt;h1&gt;C'est devenu indispensable&lt;/h1&gt;
&lt;p&gt;Parce que :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;les fen&#234;tres de contexte sont grandes mais pas infinies,&lt;/li&gt;
&lt;li&gt;les chunks bruts sont souvent trop verbeux,&lt;/li&gt;
&lt;li&gt;les embeddings r&#233;cup&#232;rent parfois trop de documents,&lt;/li&gt;
&lt;li&gt;les mod&#232;les hallucinent moins quand le contexte est &lt;em&gt;pr&#233;cis&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;La contextual compression permet :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;d'augmenter la pr&#233;cision,&lt;/li&gt;
&lt;li&gt;de r&#233;duire le bruit,&lt;/li&gt;
&lt;li&gt;d'am&#233;liorer la factualit&#233;,&lt;/li&gt;
&lt;li&gt;de diminuer le co&#251;t.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;Les 3 grandes familles de contextual compression&lt;/h1&gt;
&lt;h2&gt;1. Compression par r&#233;sum&#233; (LLM summarization)&lt;/h2&gt;
&lt;p&gt;On r&#233;cup&#232;re les documents pertinents, puis on demandes au LLM :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&#171; R&#233;sume uniquement les parties utiles pour r&#233;pondre &#224; la requ&#234;te X. &#187;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;C'est la version la plus simple et la plus efficace.&lt;/p&gt;
&lt;h3&gt;Exemple&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Document : 3 pages&lt;/li&gt;
&lt;li&gt;Requ&#234;te : &#171; Quels sont les effets secondaires du m&#233;dicament ? &#187;&lt;/li&gt;
&lt;li&gt;R&#233;sum&#233; compress&#233; : 4 lignes cibl&#233;es&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. Compression par extraction (LLM extraction)&lt;/h2&gt;
&lt;p&gt;Le LLM ne r&#233;sume pas : il &lt;strong&gt;extrait&lt;/strong&gt; les passages pertinents.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&#171; Extrait uniquement les phrases qui r&#233;pondent &#224; la question X. &#187;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;C'est plus pr&#233;cis et moins risqu&#233; que le r&#233;sum&#233;.&lt;/p&gt;
&lt;h2&gt;3. Compression par filtrage s&#233;mantique (embedding&#8209;based filtering)&lt;/h2&gt;
&lt;p&gt;On fait un &lt;em&gt;re&#8209;ranking&lt;/em&gt; interne :&lt;/p&gt;
&lt;ol class=&#034;spip&#034;&gt;
&lt;li&gt;r&#233;cup&#233;rer les chunks via embeddings.&lt;/li&gt;
&lt;li&gt;re&#8209;embed de chaque chunk &lt;strong&gt;par rapport &#224; la requ&#234;te&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&#233;limination des chunks peu pertinents.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;C'est du &lt;em&gt;semantic pruning&lt;/em&gt;.&lt;/p&gt;
&lt;h1&gt;Comment &#231;a s'int&#232;gre dans un pipeline RAG ?&lt;/h1&gt;
&lt;p&gt;Voici le pipeline classique :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;User query
&#8594; embedding de la requ&#234;te
&#8594; retrieval (top&#8209;k documents)
&#8594; contextual compression (r&#233;sum&#233; / extraction / filtrage)
&#8594; Prompt final = system + historique + requ&#234;te + contexte compress&#233;
&#8594; LLM&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;La compression intervient entre le retrieval et le prompt final.&lt;/p&gt;
&lt;h1&gt;Pourquoi c'est sup&#233;rieur au RAG na&#239;f ?&lt;/h1&gt;
&lt;h3&gt;Sans compression :&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;envoit trop de texte,&lt;/li&gt;
&lt;li&gt;d&#233;passe la fen&#234;tre,&lt;/li&gt;
&lt;li&gt;ajoute du bruit,&lt;/li&gt;
&lt;li&gt;augmente les hallucinations.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Avec compression :&lt;/h3&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;n'envoie que l'essentiel,&lt;/li&gt;
&lt;li&gt;reste dans la fen&#234;tre,&lt;/li&gt;
&lt;li&gt;augmente la pr&#233;cision,&lt;/li&gt;
&lt;li&gt;r&#233;duit le co&#251;t.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le point cl&#233; : la compression est contextuelle&lt;br /&gt;
Ce n'est pas un r&#233;sum&#233; g&#233;n&#233;rique.&lt;br /&gt;
C'est un r&#233;sum&#233; &lt;strong&gt;conditionn&#233; par la requ&#234;te&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Exemple :&lt;/p&gt;
&lt;ul class=&#034;spip&#034;&gt;
&lt;li&gt;Requ&#234;te A : &#171; Quels sont les risques ? &#187;&lt;/li&gt;
&lt;li&gt;Requ&#234;te B : &#171; Quels sont les b&#233;n&#233;fices ? &#187;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Le m&#234;me document donnera &lt;strong&gt;deux compressions diff&#233;rentes&lt;/strong&gt; pour des requ&#234;tes diff&#233;rentes.&lt;/p&gt;
&lt;p&gt;Notons que, par requ&#234;te, on peut entendre historique + question. Ainsi, la m&#234;me question de l'utilisateur, apr&#232;s avoir pos&#233; diff&#233;rentes questions et obtenu diff&#233;rentes r&#233;ponses, une nouvelle question sera trait&#233;e en tenant compte des pr&#233;c&#233;dentes.&lt;/p&gt;
&lt;p&gt;C'est ce qui rend la technique si puissante.&lt;/p&gt;
&lt;h1&gt;Les erreurs fr&#233;quentes&lt;/h1&gt;
&lt;p&gt;-r&#233;sumer les documents &lt;em&gt;avant&lt;/em&gt; le retrieval&lt;br /&gt;
&#8594; tu perds de l'information utile&lt;/p&gt;
&lt;p&gt;-compresser sans conditionner sur la requ&#234;te&lt;br /&gt;
&#8594; tu obtiens un r&#233;sum&#233; g&#233;n&#233;rique, inutile&lt;/p&gt;
&lt;p&gt;-compresser trop t&#244;t dans le pipeline&lt;br /&gt;
&#8594; tu risques de biaiser la recherche&lt;/p&gt;
&lt;p&gt;-compresser avec un mod&#232;le trop faible&lt;br /&gt;
&#8594; tu introduis des erreurs dans le contexte&lt;/p&gt;
&lt;h1&gt;Comment faire une contextual compression robuste ?&lt;/h1&gt;
&lt;h3&gt;&#201;tape 1 &#8212; Retrieval large (top&#8209;20 ou top&#8209;50)&lt;/h3&gt;
&lt;p&gt;On r&#233;cup&#232;re large pour ne rien rater.&lt;/p&gt;
&lt;h3&gt;&#201;tape 2 &#8212; Re&#8209;ranking (embedding ou cross&#8209;encoder)&lt;/h3&gt;
&lt;p&gt;On r&#233;duit &#224; top&#8209;5 ou top&#8209;10.&lt;/p&gt;
&lt;h3&gt;&#201;tape 3 &#8212; Compression LLM (r&#233;sum&#233;/extraction)&lt;/h3&gt;
&lt;p&gt;On produit un contexte propre, court, pr&#233;cis.&lt;/p&gt;
&lt;h3&gt;&#201;tape 4 &#8212; Prompt final&lt;/h3&gt;
&lt;p&gt;On injecte uniquement la version compress&#233;e.&lt;/p&gt;
&lt;p&gt;Ce pipeline est beaucoup plus stable que le RAG na&#239;f.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>



</channel>

</rss>
