Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Création de l’agent pour le gala","local":"création-de-lagent-pour-le-gala","sections":[{"title":"Assemblage d’Alfred : l’agent complet","local":"assemblage-dalfred--lagent-complet","sections":[],"depth":2},{"title":"Utilisation d’Alfred : exemples de bout en bout","local":"utilisation-dalfred--exemples-de-bout-en-bout","sections":[{"title":"Exemple 1 : trouver des informations sur les invités","local":"exemple-1--trouver-des-informations-sur-les-invités","sections":[],"depth":3},{"title":"Exemple 2 : Vérifier la météo pour le feu d’artifice","local":"exemple-2--vérifier-la-météo-pour-le-feu-dartifice","sections":[],"depth":3},{"title":"Exemple 3 : impressionner les chercheurs en IA","local":"exemple-3--impressionner-les-chercheurs-en-ia","sections":[],"depth":3},{"title":"Exemple 4 : combiner plusieurs outils","local":"exemple-4--combiner-plusieurs-outils","sections":[],"depth":3}],"depth":2},{"title":"Fonctionnalités avancées : une mémoire de la conversation","local":"fonctionnalités-avancées--une-mémoire-de-la-conversation","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}"> | |
| <link href="/docs/agents-course/pr_673/fr/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/entry/start.6a3cabb6.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/scheduler.505acc25.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/singletons.f87ed60a.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/index.001f95d5.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/paths.cc8cef00.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/entry/app.bbc296eb.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/preload-helper.f888915a.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/index.b1175496.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/nodes/0.8f31a791.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/each.e59479a4.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/nodes/67.2f7c73f4.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/Heading.aedc5b40.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/MermaidChart.svelte_svelte_type_style_lang.11cb69c9.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/CodeBlock.91f006af.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/HfOption.ccfd750e.js"> | |
| <link rel="modulepreload" href="/docs/agents-course/pr_673/fr/_app/immutable/chunks/stores.f19d72fe.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Création de l’agent pour le gala","local":"création-de-lagent-pour-le-gala","sections":[{"title":"Assemblage d’Alfred : l’agent complet","local":"assemblage-dalfred--lagent-complet","sections":[],"depth":2},{"title":"Utilisation d’Alfred : exemples de bout en bout","local":"utilisation-dalfred--exemples-de-bout-en-bout","sections":[{"title":"Exemple 1 : trouver des informations sur les invités","local":"exemple-1--trouver-des-informations-sur-les-invités","sections":[],"depth":3},{"title":"Exemple 2 : Vérifier la météo pour le feu d’artifice","local":"exemple-2--vérifier-la-météo-pour-le-feu-dartifice","sections":[],"depth":3},{"title":"Exemple 3 : impressionner les chercheurs en IA","local":"exemple-3--impressionner-les-chercheurs-en-ia","sections":[],"depth":3},{"title":"Exemple 4 : combiner plusieurs outils","local":"exemple-4--combiner-plusieurs-outils","sections":[],"depth":3}],"depth":2},{"title":"Fonctionnalités avancées : une mémoire de la conversation","local":"fonctionnalités-avancées--une-mémoire-de-la-conversation","sections":[],"depth":2},{"title":"Conclusion","local":"conclusion","sections":[],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg></button></div> </div> <h1 class="relative group"><a id="création-de-lagent-pour-le-gala" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#création-de-lagent-pour-le-gala"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Création de l’agent pour le gala</span></h1> <p data-svelte-h="svelte-1od3j0b">Maintenant que nous avons construit tous les composants nécessaires pour Alfred, il est temps de tout rassembler en un agent complet qui peut aider à organiser notre gala.</p> <p data-svelte-h="svelte-zlvz77">Dans cette section, nous allons combiner les outils de récupération d’informations sur les invités, de recherche web, d’informations météorologiques et de statistiques du Hub en un seul agent puissant.</p> <h2 class="relative group"><a id="assemblage-dalfred--lagent-complet" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#assemblage-dalfred--lagent-complet"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Assemblage d’Alfred : l’agent complet</span></h2> <p data-svelte-h="svelte-2onp7t">Au lieu de réimplémenter tous les outils que nous avons créés dans les sections précédentes, nous les importerons à partir de leurs modules respectifs que nous avons sauvegardés dans les fichiers <code>tools.py</code> et <code>retriever.py</code>.</p> <blockquote class="tip" data-svelte-h="svelte-1ox6xts"><p>Si vous n’avez pas encore implémenté les outils, retournez aux sections <a href="./tools">outils</a> et <a href="./invitees">récupérateur</a> pour les implémenter, et ajoutez-les aux fichiers <code>tools.py</code> et <code>retriever.py</code>.</p></blockquote> <p data-svelte-h="svelte-dj3ez4">Importons les bibliothèques nécessaires et les outils des sections précédentes :</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-comment"># Importer les bibliothèques nécessaires</span> | |
| <span class="hljs-keyword">import</span> random | |
| <span class="hljs-keyword">from</span> smolagents <span class="hljs-keyword">import</span> CodeAgent, InferenceClientModel | |
| <span class="hljs-comment"># Importer nos outils personnalisés de leurs modules</span> | |
| <span class="hljs-keyword">from</span> tools <span class="hljs-keyword">import</span> DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool | |
| <span class="hljs-keyword">from</span> retriever <span class="hljs-keyword">import</span> load_guest_dataset<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1cz76vd">Maintenant, combinons tous ces outils en un seul agent :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-comment"># Initialiser le modèle Hugging Face</span> | |
| model = InferenceClientModel() | |
| <span class="hljs-comment"># Initialiser l'outil de recherche web</span> | |
| search_tool = DuckDuckGoSearchTool() | |
| <span class="hljs-comment"># Initialiser l'outil météorologique</span> | |
| weather_info_tool = WeatherInfoTool() | |
| <span class="hljs-comment"># Initialiser l'outil de statistiques Hub</span> | |
| hub_stats_tool = HubStatsTool() | |
| <span class="hljs-comment"># Charger le jeu de données des invités et initialiser l'outil d'informations sur les invités</span> | |
| guest_info_tool = load_guest_dataset() | |
| <span class="hljs-comment"># Créer Alfred avec tous les outils</span> | |
| alfred = CodeAgent( | |
| tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool], | |
| model=model, | |
| add_base_tools=<span class="hljs-literal">True</span>, <span class="hljs-comment"># Ajouter tous les outils de base supplémentaires</span> | |
| planning_interval=<span class="hljs-number">3</span> <span class="hljs-comment"># Activer la planification toutes les 3 étapes</span> | |
| )<!-- HTML_TAG_END --></pre></div> </div> <p data-svelte-h="svelte-a68ksv">Votre agent est maintenant prêt à être utilisé !</p> <h2 class="relative group"><a id="utilisation-dalfred--exemples-de-bout-en-bout" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#utilisation-dalfred--exemples-de-bout-en-bout"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Utilisation d’Alfred : exemples de bout en bout</span></h2> <p data-svelte-h="svelte-1bnf2yp">Maintenant qu’Alfred est entièrement équipé de tous les outils nécessaires, voyons comment il peut aider avec diverses tâches pendant le gala.</p> <h3 class="relative group"><a id="exemple-1--trouver-des-informations-sur-les-invités" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#exemple-1--trouver-des-informations-sur-les-invités"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Exemple 1 : trouver des informations sur les invités</span></h3> <p data-svelte-h="svelte-c6azff">Voyons comment Alfred peut nous aider avec nos informations sur les invités.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->query = <span class="hljs-string">"Parle-moi de Lady Ada Lovelace"</span> | |
| response = alfred.run(query) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-cs180i">Sortie attendue :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->🎩 Réponse <span class="hljs-keyword">d</span>'Alfred : | |
| Basé sur les informations <span class="hljs-keyword">que</span> j'ai récupérées, Lady Ada Lovelace <span class="hljs-keyword">est</span> une mathématicienne estimé<span class="hljs-keyword">e</span> et une amie. Elle <span class="hljs-keyword">est</span> renommé<span class="hljs-keyword">e</span> pour son travail pionnier <span class="hljs-keyword">en</span> mathématiques et <span class="hljs-keyword">en</span> informatique, souvent cé<span class="hljs-keyword">l</span>é<span class="hljs-keyword">br</span>é<span class="hljs-keyword">e</span> comme <span class="hljs-keyword">la</span> première programmeuse informatique <span class="hljs-keyword">en</span> raison <span class="hljs-keyword">de</span> son travail sur <span class="hljs-keyword">la</span> machine analytique <span class="hljs-keyword">de</span> Charles Babbage. Son adresse email <span class="hljs-keyword">est</span> ada.lovelace@example.com.<!-- HTML_TAG_END --></pre></div> </div> <h3 class="relative group"><a id="exemple-2--vérifier-la-météo-pour-le-feu-dartifice" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#exemple-2--vérifier-la-météo-pour-le-feu-dartifice"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Exemple 2 : Vérifier la météo pour le feu d’artifice</span></h3> <p data-svelte-h="svelte-1pbmn7h">Voyons comment Alfred peut nous aider avec la météo.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->query = <span class="hljs-string">"Quel temps fait-il à Paris ce soir ? Sera-t-il approprié pour notre spectacle pyrotechnique ?"</span> | |
| response = alfred.run(query) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-5a12ea">Sortie attendue (variera en raison du caractère aléatoire) :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->🎩 Réponse <span class="hljs-keyword">d</span>'Alfred : | |
| J'ai vérifié <span class="hljs-keyword">la</span> <span class="hljs-keyword">m</span>étéo à Paris pour vous. Actuellement, il fait clair avec une température <span class="hljs-keyword">de</span> 25°C. Ces conditions sont parfaites pour le spectacle <span class="hljs-keyword">de</span> feux <span class="hljs-keyword">d</span>'artifice ce soir. Le ciel clair offrira une excellente visibilité pour le spectacle spectaculaire, et <span class="hljs-keyword">la</span> température confortable s'assurera <span class="hljs-keyword">que</span> les invités peuvent profiter <span class="hljs-keyword">de</span> <span class="hljs-keyword">l</span>'événement <span class="hljs-keyword">en</span> plein air sans inconfort.<!-- HTML_TAG_END --></pre></div> </div> <h3 class="relative group"><a id="exemple-3--impressionner-les-chercheurs-en-ia" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#exemple-3--impressionner-les-chercheurs-en-ia"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Exemple 3 : impressionner les chercheurs en IA</span></h3> <p data-svelte-h="svelte-1btu474">Voyons comment Alfred peut nous aider à impressionner les chercheurs en IA.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->query = <span class="hljs-string">"Un de nos invités vient de Qwen. Que peux-tu me dire sur leur modèle le plus populaire ?"</span> | |
| response = alfred.run(query) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-cs180i">Sortie attendue :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->🎩 Réponse d<span class="hljs-symbol">'Alfred</span> : | |
| <span class="hljs-type">Le</span> <span class="hljs-keyword">mod</span>èle Qwen le plus populaire est Qwen/Qwen2.<span class="hljs-number">5</span>-VL-<span class="hljs-number">7</span>B-Instruct avec <span class="hljs-number">3</span> <span class="hljs-number">313</span> <span class="hljs-number">345</span> téléchargements.<!-- HTML_TAG_END --></pre></div> </div> <h3 class="relative group"><a id="exemple-4--combiner-plusieurs-outils" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#exemple-4--combiner-plusieurs-outils"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Exemple 4 : combiner plusieurs outils</span></h3> <p data-svelte-h="svelte-1wwfvwu">Voyons comment Alfred peut nous aider à préparer une conversation avec le Dr. Nikola Tesla.</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->query = <span class="hljs-string">"J'ai besoin de parler avec le Dr. Nikola Tesla des avancées récentes en énergie sans fil. Peux-tu m'aider à préparer cette conversation ?"</span> | |
| response = alfred.run(query) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response)<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-cs180i">Sortie attendue :</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->🎩 Réponse <span class="hljs-keyword">d</span>'Alfred : | |
| J'ai rassemblé <span class="hljs-keyword">des</span> informations pour vous aider à <span class="hljs-keyword">pr</span>éparer votre conversation avec le Dr. Nikola Tesla. | |
| Informations sur <span class="hljs-keyword">l</span>'invité : | |
| Nom : Dr. Nikola Tesla | |
| Relation : vieil ami <span class="hljs-keyword">de</span> <span class="hljs-keyword">la</span> période à <span class="hljs-keyword">l</span>'université | |
| Description : Le Dr. Nikola Tesla <span class="hljs-keyword">est</span> un vieil ami <span class="hljs-keyword">de</span> votre période à <span class="hljs-keyword">l</span>'université. Il vient récemment <span class="hljs-keyword">de</span> breveter un nouveau système <span class="hljs-keyword">de</span> transmission <span class="hljs-keyword">d</span>'énergie sans fil et serait ravi <span class="hljs-keyword">d</span>'<span class="hljs-keyword">en</span> discuter avec vous. <span class="hljs-keyword">N</span>'oubliez pas <span class="hljs-keyword">qu</span>'il <span class="hljs-keyword">est</span> passionné par les pigeons, donc cela pourrait faire une bonne conversation. | |
| Email : nikola.tesla@gmail.com | |
| Avancées récentes <span class="hljs-keyword">en</span> énergie sans fil : | |
| Basé sur <span class="hljs-keyword">ma</span> recherche web, voici quelques <span class="hljs-keyword">d</span>éveloppements récents <span class="hljs-keyword">en</span> transmission <span class="hljs-keyword">d</span>'énergie sans fil : | |
| 1. Les chercheurs ont fait <span class="hljs-keyword">des</span> <span class="hljs-keyword">progr</span>ès dans <span class="hljs-keyword">la</span> transmission <span class="hljs-keyword">d</span>'énergie sans fil à longue porté<span class="hljs-keyword">e</span> utilisant <span class="hljs-keyword">des</span> ondes électromagnétiques focalisées | |
| 2. Plusieurs entreprises <span class="hljs-keyword">d</span>éveloppent <span class="hljs-keyword">des</span> technologies <span class="hljs-keyword">de</span> couplage inductif résonnant pour <span class="hljs-keyword">l</span>'électronique grand public | |
| 3. Il y a <span class="hljs-keyword">de</span> nouvelles applications dans <span class="hljs-keyword">la</span> recharge <span class="hljs-keyword">de</span> véhicules électriques sans connexions physiques | |
| Amorces <span class="hljs-keyword">de</span> conversation : | |
| 1. <span class="hljs-string">"J'adorerais entendre parler de votre nouveau brevet sur la transmission d'énergie sans fil. Comment se compare-t-il à vos concepts originaux de votre période à l'université ?"</span> | |
| 2. <span class="hljs-string">"Avez-vous vu les développements récents en couplage inductif résonnant pour l'électronique grand public ? Que pensez-vous de leur approche ?"</span> | |
| 3. <span class="hljs-string">"Comment vont vos pigeons ? Je me souviens de votre fascination pour eux."</span> | |
| Cela devrait vous donner <span class="hljs-keyword">de</span> quoi discuter avec le Dr. Tesla tout <span class="hljs-keyword">en</span> <span class="hljs-keyword">d</span>émontrant votre connaissance <span class="hljs-keyword">de</span> ses intérêts et <span class="hljs-keyword">des</span> <span class="hljs-keyword">d</span>éveloppements récents dans son domaine.<!-- HTML_TAG_END --></pre></div> </div> <h2 class="relative group"><a id="fonctionnalités-avancées--une-mémoire-de-la-conversation" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#fonctionnalités-avancées--une-mémoire-de-la-conversation"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Fonctionnalités avancées : une mémoire de la conversation</span></h2> <p data-svelte-h="svelte-1mfz34m">Pour rendre Alfred encore plus utile pendant le gala, nous pouvons activer une mémoire de la conversation pour qu’il se souvienne des interactions précédentes :</p> <div class="flex space-x-2 items-center my-1.5 mr-8 h-7 !pl-0 -mx-3 md:mx-0"><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd border-gray-800 bg-black dark:bg-gray-700 text-white">smolagents </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">llama-index </div><div class="flex items-center border rounded-lg px-1.5 py-1 leading-none select-none text-smd text-gray-500 cursor-pointer opacity-90 hover:text-gray-700 dark:hover:text-gray-200 hover:shadow-sm">langgraph </div></div> <div class="language-select"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-comment"># Créer Alfred avec une mémoire de la conversation</span> | |
| alfred_with_memory = CodeAgent( | |
| tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool], | |
| model=model, | |
| add_base_tools=<span class="hljs-literal">True</span>, | |
| planning_interval=<span class="hljs-number">3</span> | |
| ) | |
| <span class="hljs-comment"># Première interaction</span> | |
| response1 = alfred_with_memory.run(<span class="hljs-string">"Parle-moi de Lady Ada Lovelace."</span>) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Première réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response1) | |
| <span class="hljs-comment"># Deuxième interaction (faisant référence à la première)</span> | |
| response2 = alfred_with_memory.run(<span class="hljs-string">"Sur quels projets travaille-t-elle actuellement ?"</span>, reset=<span class="hljs-literal">False</span>) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">"🎩 Deuxième réponse d'Alfred :"</span>) | |
| <span class="hljs-built_in">print</span>(response2)<!-- HTML_TAG_END --></pre></div> </div> <p data-svelte-h="svelte-x8lnkt">Remarquez qu’aucune de ces trois approches ne couple directement la mémoire avec l’agent. Y a-t-il une raison spécifique pour ce choix de conception 🧐 ?</p> <ul data-svelte-h="svelte-983wab"><li>smolagents : La mémoire n’est pas préservée entre différentes exécutions, vous devez explicitement la déclarer en utilisant <code>reset=False</code>.</li> <li>LlamaIndex : Nécessite d’ajouter explicitement un objet de contexte pour la gestion de la mémoire au sein d’une exécution.</li> <li>LangGraph : Offre des options pour récupérer les messages précédents ou utiliser un composant <a href="https://langchain-ai.github.io/langgraph/tutorials/introduction/#part-3-adding-memory-to-the-chatbot" rel="nofollow">MemorySaver</a> dédié.</li></ul> <h2 class="relative group"><a id="conclusion" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#conclusion"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Conclusion</span></h2> <p data-svelte-h="svelte-kzcry9">Félicitations ! Vous avez réussi à construire Alfred, un agent sophistiqué équipé de plusieurs outils pour aider à organiser le gala le plus extravagant du siècle. Il peut maintenant :</p> <ol data-svelte-h="svelte-us0rks"><li>Récupérer des informations détaillées sur les invités</li> <li>Vérifier les conditions météorologiques pour planifier les activités en plein air</li> <li>Fournir des informations sur les constructeurs d’IA influents et leurs modèles</li> <li>Rechercher sur le web les dernières informations</li> <li>Maintenir le contexte de conversation avec la mémoire</li></ol> <p data-svelte-h="svelte-9c2qz0">Avec ces capacités, Alfred est prêt à s’assurer que votre gala soit un succès retentissant, impressionnant les invités avec une attention personnalisée et des informations à jour.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/agents-course/blob/main/units/fr/unit3/agentic-rag/agent.mdx" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg> <span data-svelte-h="svelte-zjs2n5"><span class="underline">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1b31nyx = { | |
| assets: "/docs/agents-course/pr_673/fr", | |
| base: "/docs/agents-course/pr_673/fr", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/agents-course/pr_673/fr/_app/immutable/entry/start.6a3cabb6.js"), | |
| import("/docs/agents-course/pr_673/fr/_app/immutable/entry/app.bbc296eb.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 67], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 50.8 kB
- Xet hash:
- 29d7bda4c6e0662ead6d2b33bb21e1517b5d923c07148aaf8ec704239210942b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.