{"id":1344,"date":"2024-04-17T11:20:50","date_gmt":"2024-04-17T11:20:50","guid":{"rendered":"https:\/\/ignos.blog\/?p=1344"},"modified":"2025-01-16T15:21:54","modified_gmt":"2025-01-16T15:21:54","slug":"langchain-and-hugging-face-introduction","status":"publish","type":"post","link":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction","title":{"rendered":"LangChain and Hugging Face. Introduction"},"content":{"rendered":"\n<p>Integrating Hugging Face models in natural language processing (NLP) applications has been greatly facilitated by the possibilities provided by the use of the LangChain framework and, additionally, the ability to build locally deployed solutions thanks to <a href=\"https:\/\/ignos.blog\/en\/lm-studio\">LM Studio<\/a>. The combination of these technologies allows you to take advantage of <a href=\"https:\/\/ignos.blog\/en\/llm-ignos\">Hugging Face<\/a> &#8216;s large collection of pre-trained models and LangChain&#8217;s flexibility in creating customized workflows for each use case.<\/p>\n\n<p>In the following sections we will show in a concise way how to make use of these components to integrate them in a specific application, we will use a Python based development environment although the explanations will be similar for other languages\/frameworks.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"h-configuracion-inicial\"><strong>Initial Configuration<\/strong><\/h2>\n\n<p>Before starting, it is necessary to install the Python packages <code>transformers<\/code> and <code>huggingface_hub<\/code>. These packages allow Hugging Face models to be accessed and run locally through LangChain.<\/p>\n\n<pre class=\"wp-block-code has-small-font-size\"><code>%pip install --upgrade --quiet transformers huggingface_hub<\/code><\/pre>\n\n<p><strong>Load a Hugging Face Model<\/strong><\/p>\n\n<p>To load a model, you can use the class <code>HuggingFacePipeline<\/code> in LangChain, specifying the model ID and the task to be performed. This allows you to load models directly from the Hugging Face Model Hub and run them in your local environment.<\/p>\n\n<pre class=\"wp-block-code\"><code>from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline\n\nhf = HuggingFacePipeline.from_model_id(\n    model_id=\"gpt2\",\n    task=\"text-generation\",\n    pipeline_kwargs={\"max_new_tokens\": 10},\n)<\/code><\/pre>\n\n<p><strong>Create and Execute a &#8220;chain<\/strong><\/p>\n\n<p>LangChain facilitates the creation of chains, which are sequences of operations to be performed on the text. You can compose a model with a prompt using <code>PromptTemplate<\/code> to form a chain, which allows a customized interaction with the loaded model. In the following example, a template is created for a prompt that will answer a given question by constructing a step-by-step reasoned explanation. Subsequently, a chain is constructed that passes the prompt to the loaded model and finally the chain is invoked (executed) to obtain the result.<\/p>\n\n<pre class=\"wp-block-code\"><code>from langchain.prompts import PromptTemplate\n\ntemplate = \"\"\"Question: {question}  \n\nAnswer: Let's think step by step.\"\"\"\nprompt = PromptTemplate.from_template(template)\n\nchain = prompt | hf\n\nquestion = \"What is electroencephalography?\"\n\nprint(chain.invoke({\"question\": question}))<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"h-posibilidades-para-la-inferencia\">Possibilities for inference<\/h2>\n\n<p><strong>Use of GPU for Inference<\/strong><\/p>\n\n<p>LangChain offers support for GPU-based inference, which is useful for speeding up processing and handling large models. You can specify the GPU device during model loading, or use automatic device mapping with the <code>Accelerate<\/code> library if you have multiple GPUs or large models.<\/p>\n\n<pre class=\"wp-block-code\"><code>gpu_llm = HuggingFacePipeline.from_model_id(\n    model_id=\"gpt2\",\n    task=\"text-generation\",\n    device=0,  # Usa device_map=\"auto\" para mapeo autom\u00e1tico con Accelerate\n    pipeline_kwargs={\"max_new_tokens\": 10},\n)<\/code><\/pre>\n\n<p><strong>Inference with OpenVINO Backend<\/strong><\/p>\n\n<p>For deployments requiring high efficiency and low latency, LangChain supports the use of <a href=\"https:\/\/www.intel.la\/content\/www\/xl\/es\/download\/753640\/intel-distribution-of-openvino-toolkit.html\">OpenVINO<\/a> as an inference backend. This allows models to run on Intel hardware, optimizing performance and resource consumption.<\/p>\n\n<pre class=\"wp-block-code\"><code>ov_llm = HuggingFacePipeline.from_model_id(\n    model_id=\"gpt2\",\n    task=\"text-generation\",\n    backend=\"openvino\",\n    model_kwargs={\"device\": \"CPU\"},\n    pipeline_kwargs={\"max_new_tokens\": 10},\n)<\/code><\/pre>\n\n<p><strong>Access to Hugging Face Endpoints<\/strong><\/p>\n\n<p>LangChain provides access to Hugging Face endpoints to easily integrate text generation capabilities and other NLP services into your applications. For this, you will need to obtain a Hugging Face API token and configure the environment accordingly. This option facilitates development in exchange for establishing a dependency on the HuggingFace inference mechanism.<\/p>\n\n<pre class=\"wp-block-code has-small-font-size\"><code>from langchain_community.llms import HuggingFaceEndpoint\nfrom getpass import getpass\n\nHUGGINGFACEHUB_API_TOKEN = getpass()\nos.environ&#091;\"HUGGINGFACEHUB_API_TOKEN\"] = HUGGINGFACEHUB_API_TOKEN\n\nrepo_id = \"mistralai\/Mistral-7B-Instruct-v0.2\"\n\nllm = HuggingFaceEndpoint(\n    repo_id=repo_id, max_length=128, temperature=0.5, token=HUGGINGFACEHUB_API_TOKEN\n)<\/code><\/pre>\n\n<p>The integration of Hugging Face with LangChain and LM Studio provides a powerful platform for the development of NLP solutions, combining the accessibility of advanced pre-trained models with the flexibility of a framework dedicated to the creation of NLP applications.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"h-endpoints-locales-usando-lm-studio\">Local endpoints using LM Studio<\/h2>\n\n<p>Compared to the previous options, the use of LM Studio allows you to easily load models from the HuggingFace Hub and run them locally, thus being able to control the entire development environment without losing the ease of integration provided by the use of an endpoint. In this sense, LM Studio allows the use of a local server that is fully compatible with the OpenAI API, thus simplifying the integration work, allowing the use of different models with the same API.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusiones\">Conclusion<\/h2>\n\n<p>The combination of Hugging Face, LangChain and LM Studio constitutes a powerful technology alliance that is democratizing access to advanced NLP tools, enabling developers and companies of all sizes to explore and exploit the potential of natural language processing in scenarios of any kind.<\/p>\n\n<p><\/p>\n<div class=\"shariff shariff-align-left shariff-widget-align-left\"><ul class=\"shariff-buttons theme-default orientation-horizontal buttonsize-medium\"><li class=\"shariff-button mastodon shariff-nocustomcolor\" style=\"background-color:#563ACC\"><a href=\"https:\/\/s2f.kytta.dev\/?text=LangChain%20and%20Hugging%20Face.%20Introduction https%3A%2F%2Fignos.blog%2Fen%2Flangchain-and-hugging-face-introduction\" title=\"Compartir en Mastodon\" aria-label=\"Compartir en Mastodon\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#6364FF; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"75\" height=\"79\" viewBox=\"0 0 75 79\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M37.813-.025C32.462-.058 27.114.13 21.79.598c-8.544.621-17.214 5.58-20.203 13.931C-1.12 23.318.408 32.622.465 41.65c.375 7.316.943 14.78 3.392 21.73 4.365 9.465 14.781 14.537 24.782 15.385 7.64.698 15.761-.213 22.517-4.026a54.1 54.1 0 0 0 .01-6.232c-6.855 1.316-14.101 2.609-21.049 1.074-3.883-.88-6.876-4.237-7.25-8.215-1.53-3.988 3.78-.43 5.584-.883 9.048 1.224 18.282.776 27.303-.462 7.044-.837 14.26-4.788 16.65-11.833 2.263-6.135 1.215-12.79 1.698-19.177.06-3.84.09-7.692-.262-11.52C72.596 7.844 63.223.981 53.834.684a219.453 219.453 0 0 0-16.022-.71zm11.294 12.882c5.5-.067 10.801 4.143 11.67 9.653.338 1.48.471 3 .471 4.515v21.088h-8.357c-.07-7.588.153-15.182-.131-22.765-.587-4.368-7.04-5.747-9.672-2.397-2.422 3.04-1.47 7.155-1.67 10.735v6.392h-8.307c-.146-4.996.359-10.045-.404-15.002-1.108-4.218-7.809-5.565-10.094-1.666-1.685 3.046-.712 6.634-.976 9.936v14.767h-8.354c.109-8.165-.238-16.344.215-24.5.674-5.346 5.095-10.389 10.676-10.627 4.902-.739 10.103 2.038 12.053 6.631.375 1.435 1.76 1.932 1.994.084 1.844-3.704 5.501-6.739 9.785-6.771.367-.044.735-.068 1.101-.073z\"\/><defs><linearGradient id=\"paint0_linear_549_34\" x1=\"37.0692\" y1=\"0\" x2=\"37.0692\" y2=\"79\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#6364FF\"\/><stop offset=\"1\" stop-color=\"#563ACC\"\/><\/linearGradient><\/defs><\/svg><\/span><span class=\"shariff-text\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fignos.blog%2Fen%2Flangchain-and-hugging-face-introduction\" title=\"Compartir en Facebook\" aria-label=\"Compartir en Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button linkedin shariff-nocustomcolor\" style=\"background-color:#1488bf\"><a href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fignos.blog%2Fen%2Flangchain-and-hugging-face-introduction\" title=\"Compartir en LinkedIn\" aria-label=\"Compartir en LinkedIn\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0077b5; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#0077b5\" d=\"M6.2 11.2v17.7h-5.9v-17.7h5.9zM6.6 5.7q0 1.3-0.9 2.2t-2.4 0.9h0q-1.5 0-2.4-0.9t-0.9-2.2 0.9-2.2 2.4-0.9 2.4 0.9 0.9 2.2zM27.4 18.7v10.1h-5.9v-9.5q0-1.9-0.7-2.9t-2.3-1.1q-1.1 0-1.9 0.6t-1.2 1.5q-0.2 0.5-0.2 1.4v9.9h-5.9q0-7.1 0-11.6t0-5.3l0-0.9h5.9v2.6h0q0.4-0.6 0.7-1t1-0.9 1.6-0.8 2-0.3q3 0 4.9 2t1.9 6z\"\/><\/svg><\/span><span class=\"shariff-text\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button info shariff-nocustomcolor\" style=\"background-color:#eee\"><a href=\"http:\/\/ct.de\/-2467514\" title=\"M\u00e1s informaciones\" aria-label=\"M\u00e1s informaciones\" role=\"button\" rel=\"noopener \" class=\"shariff-link\" style=\"; background-color:#fff; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 11 32\"><path fill=\"#999\" d=\"M11.4 24v2.3q0 0.5-0.3 0.8t-0.8 0.4h-9.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h1.1v-6.8h-1.1q-0.5 0-0.8-0.4t-0.4-0.8v-2.3q0-0.5 0.4-0.8t0.8-0.4h6.8q0.5 0 0.8 0.4t0.4 0.8v10.3h1.1q0.5 0 0.8 0.4t0.3 0.8zM9.2 3.4v3.4q0 0.5-0.4 0.8t-0.8 0.4h-4.6q-0.4 0-0.8-0.4t-0.4-0.8v-3.4q0-0.4 0.4-0.8t0.8-0.4h4.6q0.5 0 0.8 0.4t0.4 0.8z\"\/><\/svg><\/span><\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Integrating Hugging Face models in natural language processing (NLP) applications has been greatly facilitated by the possibilities provided by the use of the LangChain framework<\/p>\n","protected":false},"author":2,"featured_media":1342,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[46,47],"tags":[],"class_list":["post-1344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence-en","category-bi-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>LangChain and Hugging Face. Introduction - Ignos Blog<\/title>\n<meta name=\"description\" content=\"Take advantage of LangChain&#039;s flexibility and Hugging Face&#039;s collection of models to develop customized NLP solutions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LangChain and Hugging Face. Introduction\" \/>\n<meta property=\"og:description\" content=\"Integrating Hugging Face models in natural language processing (NLP) applications has been greatly facilitated by the possibilities provided by the use of\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction\" \/>\n<meta property=\"og:site_name\" content=\"Ignos Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-17T11:20:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-16T15:21:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"ignosblog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ignosblog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction\"},\"author\":{\"name\":\"ignosblog\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#\\\/schema\\\/person\\\/1a5938d22bbcdc65527e74d23e620b69\"},\"headline\":\"LangChain and Hugging Face. Introduction\",\"datePublished\":\"2024-04-17T11:20:50+00:00\",\"dateModified\":\"2025-01-16T15:21:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction\"},\"wordCount\":593,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/langchain-huggingface.webp\",\"articleSection\":[\"Artificial Intelligence\",\"BI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction\",\"url\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction\",\"name\":\"LangChain and Hugging Face. Introduction - Ignos Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/langchain-huggingface.webp\",\"datePublished\":\"2024-04-17T11:20:50+00:00\",\"dateModified\":\"2025-01-16T15:21:54+00:00\",\"description\":\"Take advantage of LangChain's flexibility and Hugging Face's collection of models to develop customized NLP solutions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#primaryimage\",\"url\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/langchain-huggingface.webp\",\"contentUrl\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/langchain-huggingface.webp\",\"width\":1024,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en\\\/langchain-and-hugging-face-introduction#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\\\/\\\/ignos.blog\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LangChain and Hugging Face. Introduction\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#website\",\"url\":\"https:\\\/\\\/ignos.blog\\\/en\",\"name\":\"Ignos Blog\",\"description\":\"Convirtiendo problemas en retos. Te ayudamos con Big Data, IA, ML, Odoo, ...\",\"publisher\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ignos.blog\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#organization\",\"name\":\"Ignos\",\"url\":\"https:\\\/\\\/ignos.blog\\\/en\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/cropped-ignos-logotipo-rgb-72ppp-11.jpg\",\"contentUrl\":\"https:\\\/\\\/ignos.blog\\\/wp-content\\\/uploads\\\/2018\\\/05\\\/cropped-ignos-logotipo-rgb-72ppp-11.jpg\",\"width\":396,\"height\":158,\"caption\":\"Ignos\"},\"image\":{\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/es.linkedin.com\\\/company\\\/ignos-estudio-de-ingenier-a-s.l.\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ignos.blog\\\/en#\\\/schema\\\/person\\\/1a5938d22bbcdc65527e74d23e620b69\",\"name\":\"ignosblog\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"LangChain and Hugging Face. Introduction - Ignos Blog","description":"Take advantage of LangChain's flexibility and Hugging Face's collection of models to develop customized NLP solutions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction","og_locale":"en_US","og_type":"article","og_title":"LangChain and Hugging Face. Introduction","og_description":"Integrating Hugging Face models in natural language processing (NLP) applications has been greatly facilitated by the possibilities provided by the use of","og_url":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction","og_site_name":"Ignos Blog","article_published_time":"2024-04-17T11:20:50+00:00","article_modified_time":"2025-01-16T15:21:54+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp","type":"image\/webp"}],"author":"ignosblog","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ignosblog","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#article","isPartOf":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction"},"author":{"name":"ignosblog","@id":"https:\/\/ignos.blog\/en#\/schema\/person\/1a5938d22bbcdc65527e74d23e620b69"},"headline":"LangChain and Hugging Face. Introduction","datePublished":"2024-04-17T11:20:50+00:00","dateModified":"2025-01-16T15:21:54+00:00","mainEntityOfPage":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction"},"wordCount":593,"commentCount":0,"publisher":{"@id":"https:\/\/ignos.blog\/en#organization"},"image":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#primaryimage"},"thumbnailUrl":"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp","articleSection":["Artificial Intelligence","BI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction","url":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction","name":"LangChain and Hugging Face. Introduction - Ignos Blog","isPartOf":{"@id":"https:\/\/ignos.blog\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#primaryimage"},"image":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#primaryimage"},"thumbnailUrl":"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp","datePublished":"2024-04-17T11:20:50+00:00","dateModified":"2025-01-16T15:21:54+00:00","description":"Take advantage of LangChain's flexibility and Hugging Face's collection of models to develop customized NLP solutions.","breadcrumb":{"@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#primaryimage","url":"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp","contentUrl":"https:\/\/ignos.blog\/wp-content\/uploads\/2024\/04\/langchain-huggingface.webp","width":1024,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/ignos.blog\/en\/langchain-and-hugging-face-introduction#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/ignos.blog\/en"},{"@type":"ListItem","position":2,"name":"LangChain and Hugging Face. Introduction"}]},{"@type":"WebSite","@id":"https:\/\/ignos.blog\/en#website","url":"https:\/\/ignos.blog\/en","name":"Ignos Blog","description":"Convirtiendo problemas en retos. Te ayudamos con Big Data, IA, ML, Odoo, ...","publisher":{"@id":"https:\/\/ignos.blog\/en#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ignos.blog\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ignos.blog\/en#organization","name":"Ignos","url":"https:\/\/ignos.blog\/en","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ignos.blog\/en#\/schema\/logo\/image\/","url":"https:\/\/ignos.blog\/wp-content\/uploads\/2018\/05\/cropped-ignos-logotipo-rgb-72ppp-11.jpg","contentUrl":"https:\/\/ignos.blog\/wp-content\/uploads\/2018\/05\/cropped-ignos-logotipo-rgb-72ppp-11.jpg","width":396,"height":158,"caption":"Ignos"},"image":{"@id":"https:\/\/ignos.blog\/en#\/schema\/logo\/image\/"},"sameAs":["https:\/\/es.linkedin.com\/company\/ignos-estudio-de-ingenier-a-s.l."]},{"@type":"Person","@id":"https:\/\/ignos.blog\/en#\/schema\/person\/1a5938d22bbcdc65527e74d23e620b69","name":"ignosblog"}]}},"_links":{"self":[{"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/posts\/1344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/comments?post=1344"}],"version-history":[{"count":4,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/posts\/1344\/revisions"}],"predecessor-version":[{"id":1418,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/posts\/1344\/revisions\/1418"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/media\/1342"}],"wp:attachment":[{"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/media?parent=1344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/categories?post=1344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ignos.blog\/en\/wp-json\/wp\/v2\/tags?post=1344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}