{"id":8131,"date":"2023-11-08T06:13:09","date_gmt":"2023-11-08T14:13:09","guid":{"rendered":"https:\/\/live-cometml.pantheonsite.io\/?p=8131"},"modified":"2025-04-24T17:04:33","modified_gmt":"2025-04-24T17:04:33","slug":"lcel-a-guide-to-langchain-expression-language","status":"publish","type":"post","link":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/","title":{"rendered":"LCEL: A Guide to LangChain Expression Language"},"content":{"rendered":"\n<h2 class=\"wp-block-heading graf graf--h4\">Streamlining Text Processing and Interaction with Advanced Language Models<\/h2>\n\n\n\n<figure class=\"graf graf--figure\">\n<\/figure>\n\n\n\n<figure class=\"wp-block-image alignnone graf-image\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb\" alt=\"\"\/><figcaption class=\"wp-element-caption\">Photo by <a href=\"https:\/\/unsplash.com\/@helloimnik?utm_source=medium&amp;utm_medium=referral\">Nik<\/a> on\u00a0<a href=\"http:\/\/Unsplash.com\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to LCEL<\/h2>\n\n\n\n<p class=\"graf graf--p\">The LangChain Expression Language (LCEL) is a pivotal addition to the LangChain toolkit, designed to enhance the efficiency and flexibility of text processing tasks.<\/p>\n\n\n\n<p class=\"graf graf--p\">This guide provides an in-depth overview of LCEL\u2019s capabilities, from its initial setup to its advanced functionalities. With LCEL, users can adopt a declarative approach to chain composition, facilitating operations like streaming, batch processing, and asynchronous tasks. Its modular architecture also allows for easy customization and modification of chain components.<\/p>\n\n\n\n<p class=\"graf graf--p\">Dive in to understand how LCEL can optimize your interactions with language models and streamline your text-processing workflows.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span class=\"pre--content\">%%capture\n!pip install langchain openai<\/span><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><span class=\"pre--content\">import os\nimport getpass<\/span><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><span class=\"pre--content\">os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"Enter Your OpenAI API Key:\")<\/span><\/pre>\n\n\n\n<h2 class=\"wp-block-heading graf graf--h3\">LangChain Expression Language<\/h2>\n\n\n\n<p class=\"graf graf--p\">This is a declarative way to truly compose chains\u200a\u2014\u200aand get streaming, batch, and async support out of the box.<\/p>\n\n\n\n<p class=\"graf graf--p\">You can use all the same existing LangChain constructs to create them.<\/p>\n\n\n\n<p class=\"graf graf--p\">In addition to standardizing interfaces, another advantage of LangChain is that it makes it simpler for users to personalize different parts of the chain. The chain\u2019s declarative and modular nature allows for easy components swapping. Furthermore, the prompts are now more visible and can be easily modified to suit specific use cases.<\/p>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\"><\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p class=\"graf graf--p\">The prompts in LangChain are only defaults and should be changed for production applications. Previously, modifying the prompts was challenging due to them being hidden.<\/p>\n<p class=\"graf graf--p\">Still, with LCEL, they are more prominent and easier to adjust.<\/p>\n<p class=\"graf graf--p\">This interface defines custom chains and enables standardized invocation.<\/p>\n<p class=\"graf graf--p\">The standard interface exposed includes:<\/p>\n<p class=\"graf graf--p\">\u2022 <code class=\"markup--code markup--p-code\">stream<\/code>: stream back chunks of the response<\/p>\n<p class=\"graf graf--p\">\u2022 <code class=\"markup--code markup--p-code\">invoke<\/code>: call the chain on an input<\/p>\n<p class=\"graf graf--p\">\u2022 <code class=\"markup--code markup--p-code\">batch<\/code>: call the chain on a list of inputs<\/p>\n<p class=\"graf graf--p\">These also have corresponding async methods:<\/p>\n<p class=\"graf graf--p\">\u2022 <code class=\"markup--code markup--p-code\">astream<\/code>: stream back chunks of the response async<\/p>\n<p class=\"graf graf--p\">\u2022 <code class=\"markup--code markup--p-code\">ainvoke<\/code>: call the chain on an input async<\/p>\n<ul class=\"postList\">\n<li class=\"graf graf--li\"><code class=\"markup--code markup--li-code\">abatch<\/code>: call the chain on a list of inputs async<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\">\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<blockquote class=\"graf graf--pullquote\"><p>Want to learn how to build modern software with LLMs using the newest tools and techniques in the field? <a class=\"markup--anchor markup--pullquote-anchor\" href=\"https:\/\/www.comet.com\/production\/site\/llm-course\/?utm_source=Heartbeat&amp;utm_medium=referral&amp;utm_content=Medium&amp;utm_campaign=Heartbeat_LangChain_Series_HS\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.comet.com\/production\/site\/llm-course\/?utm_source=Heartbeat&amp;utm_medium=referral&amp;utm_content=Medium&amp;utm_campaign=Heartbeat_LangChain_Series_HS\">Check out this free LLMOps course<\/a> from industry expert Elvis Saravia of&nbsp;DAIR.AI.<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"section section--body\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\">\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h2 class=\"graf graf--h3\">PromptTemplate + LLM and LCEL<\/h2>\n<p class=\"graf graf--p\">A PromptTemplate -&gt; LLM is a core chain that is used in most other larger chains\/systems.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">from langchain.chat_models import ChatOpenAI\nfrom langchain.prompts import ChatPromptTemplate\n\nmodel = ChatOpenAI()\n\nprompt = ChatPromptTemplate.from_template(\"write a rap about {thing}\")\n\nchain = prompt | model\n\nchain.invoke({\"thing\":\"bears\"})<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">AIMessage(content=\"Verse 1:\\nYo, listen up, I got a story to tell,\\n'Bout some creatures that you know so well,\\nThey're big, they're fierce, they roam the land,\\nThe kings of the wilderness, the bears command.\\n\\nChorus:\\nBears, bears, they're everywhere,\\nFrom the polar ice to the forest lair,\\nThey're strong, they're wild, they're never scared,\\nSo let me tell you 'bout these beasts, beware!\\n\\nVerse 2:\\nFirst up, we got the grizzly bear,\\nWith its powerful paws, it's a true nightmare,\\nIn the mountains and the woods, it roams free,\\nA symbol of strength, a sight to see.\\n\\nNext, we got the polar bear, so rare,\\nIn the Arctic, it's the ultimate player,\\nSurviving in the cold, icy terrain,\\nCatching seals, they're the kings of the domain.\\n\\nChorus:\\nBears, bears, they're everywhere,\\nFrom the polar ice to the forest lair,\\nThey're strong, they're wild, they're never scared,\\nSo let me tell you 'bout these beasts, beware!\\n\\nVerse 3:\\nBut let's not forget the panda bear,\\nCuteness overload, with black and white hair,\\nMunching on bamboo, living in peace,\\nAn emblem of harmony, let's give them some space.\\n\\nLastly, we got the Kodiak bear,\\nThe largest of all, a true heavyweight,\\nRoaming Alaska, where the wild things are,\\nWith a roar that shakes the earth, it's a superstar.\\n\\nChorus:\\nBears, bears, they're everywhere,\\nFrom the polar ice to the forest lair,\\nThey're strong, they're wild, they're never scared,\\nSo let me tell you 'bout these beasts, beware!\\n\\nVerse 4:\\nRespect these creatures, don't mess around,\\nThey're a vital part of nature, never let them down,\\nLet's protect their habitat, keep them alive,\\nFor future generations, let's strive.\\n\\nSo when you see a bear, give it some space,\\nAdmire from a distance, embrace its grace,\\nThese majestic beasts, they deserve our care,\\nLet's learn from them, and become aware.\\n\\nChorus:\\nBears, bears, they're everywhere,\\nFrom the polar ice to the forest lair,\\nThey're strong, they're wild, they're never scared,\\nSo let me tell you 'bout these beasts, beware!\", additional_kwargs={}, example=False)<\/span><\/pre>\n<h2 class=\"graf graf--h3\">Batch<\/h2>\n<p class=\"graf graf--p\">Batch takes a list of inputs and performs internal optimizations, such as batching calls to LLM providers.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">chain.batch([{\"thing\":\"Jattis\"}, {\"thing\":\"morning coffee\"}])<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">[AIMessage(content=\"(Verse 1)\\nYo, listen up, I got a story to tell\\n'Bout these fly ladies that I know so well\\nThey're fierce, they're strong, they're full of pride\\nJattis, the queens, they can't be denied\\n\\nRocking those suits, representing their roots\\nFrom Punjab to the world, breaking all the rules\\nWith their colorful turbans, shining like gold\\nJattis stand tall, they never fold\\n\\n(Chorus)\\nJattis in the house, breaking it down\\nThey're the queens of the town, they wear the crown\\nJattis in the house, making moves so smooth\\nThey're the definition of power and groove\\n\\n(Verse 2)\\nFrom the fields to the city, they're making their mark\\nJattis ain't afraid to chase their dreams in the dark\\nBalancing traditions with modern styles\\nJattis keep shining with their infectious smiles\\n\\nWith their bhangra moves, they own the dance floor\\nJattis got the rhythm, they never bore\\nThey're the life of the party, the center of attention\\nJattis bring the heat, no need for intervention\\n\\n(Chorus)\\nJattis in the house, breaking it down\\nThey're the queens of the town, they wear the crown\\nJattis in the house, making moves so smooth\\nThey're the definition of power and groove\\n\\n(Verse 3)\\nJattis, they're the epitome of grace\\nWith their strong spirit, they win every race\\nThey're educated, ambitious, reaching new heights\\nJattis breaking barriers, shining bright lights\\n\\nThey stand for equality, justice, and pride\\nJattis fight for their rights, side by side\\nThey're the role models, inspiring the youth\\nJattis breaking stereotypes, speaking the truth\\n\\n(Chorus)\\nJattis in the house, breaking it down\\nThey're the queens of the town, they wear the crown\\nJattis in the house, making moves so smooth\\nThey're the definition of power and groove\\n\\n(Outro)\\nSo raise your hands, let's show some love\\nTo the Jattis out there, rising above\\nThey're the queens of Punjab, the pride of the nation\\nJattis, keep shining with your determination.\", additional_kwargs={}, example=False),\n AIMessage(content=\"(Verse 1)\\nYo, wake up, it's a brand new day\\nGotta kickstart the morning in a caffeinated way\\nI grab my mug, fill it up, you know the deal\\nCoffee's the fuel that keeps me on the real\\n\\n(Chorus)\\nMorning coffee, you're my energy booster\\nAin't no other drink that can make me move faster\\nSippin' on java, feeling so alive\\nI can conquer anything, I'm ready to thrive\\n\\n(Verse 2)\\nThe aroma hits my nose, it's so divine\\nThat rich, bold flavor, it's like a wake-up sign\\nSteamin' hot, it warms my soul\\nCoffee in my hand, I'm in control\\n\\n(Chorus)\\nMorning coffee, you're my energy booster\\nAin't no other drink that can make me move faster\\nSippin' on java, feeling so alive\\nI can conquer anything, I'm ready to thrive\\n\\n(Verse 3)\\nWhether it's a latte, cappuccino, or just black\\nCoffee's got my back, never cut me no slack\\nI take a sip, and my mind starts to race\\nIdeas flow like a river, at a rapid pace\\n\\n(Chorus)\\nMorning coffee, you're my energy booster\\nAin't no other drink that can make me move faster\\nSippin' on java, feeling so alive\\nI can conquer anything, I'm ready to thrive\\n\\n(Bridge)\\nNo need for sugar or cream, keep it pure and strong\\nCoffee in my veins, it's where I belong\\nFrom sunrise to sunset, you're my loyal friend\\nMorning coffee, you'll be with me till the end\\n\\n(Chorus)\\nMorning coffee, you're my energy booster\\nAin't no other drink that can make me move faster\\nSippin' on java, feeling so alive\\nI can conquer anything, I'm ready to thrive\\n\\n(Outro)\\nSo raise your cup, let's toast to the start\\nMorning coffee, you're a work of art\\nYou keep me focused, alert, and awake\\nThank you for being the fuel that I take.\", additional_kwargs={}, example=False)]<\/span><\/pre>\n<h2 class=\"graf graf--h3\">Stream<\/h2>\n<p class=\"graf graf--p\"><code class=\"markup--code markup--p-code\">stream<\/code> returns an iterable that you can consume.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">for s in chain.stream({\"thing\":\"The Golden Temple\"}):\n  print(s.content, end=\"\")<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">(Verse 1)\nYo, listen up, I got a tale so bold\n'Bout a place that shines brighter than gold\nIn Amritsar, India, let me introduce\nThe Golden Temple, a spiritual seduce\n\n(Chorus)\nGolden Temple, oh, a sight to behold\nSacred and divine, it's a story untold\nA haven of peace, where souls unite\nCome and feel the blessings, day or night\n\n(Verse 2)\nDome of gold, glistening in the sun\nReflecting the faith of Sikhs, second to none\nBuilt with love and devotion, a symbol so grand\nFour doors, welcoming all, you'll understand\n\n(Chorus)\nGolden Temple, oh, a sight to behold\nSacred and divine, it's a story untold\nA haven of peace, where souls unite\nCome and feel the blessings, day or night\n\n(Verse 3)\nIt's not just about the shimmer and shine\nBut the Langar, a miracle, oh so fine\nA free kitchen, serving meals for all\nBreaking barriers, no matter how small\n\n(Chorus)\nGolden Temple, oh, a sight to behold\nSacred and divine, it's a story untold\nA haven of peace, where souls unite\nCome and feel the blessings, day or night\n\n(Verse 4)\nEnter the temple, leave your worries behind\nFeel the serenity, let your soul unwind\nWash your feet in the holy Amrit Sarovar\nFind solace, seek answers, no matter who you are\n\n(Chorus)\nGolden Temple, oh, a sight to behold\nSacred and divine, it's a story untold\nA haven of peace, where souls unite\nCome and feel the blessings, day or night\n\n(Bridge)\nThe Golden Temple, a beacon so bright\nA testament to love, compassion, and light\nMay it inspire us all, to spread the love\nIn this world, like the temple above\n\n(Chorus)\nGolden Temple, oh, a sight to behold\nSacred and divine, it's a story untold\nA haven of peace, where souls unite\nCome and feel the blessings, day or night\n\n(Outro)\nSo let's celebrate, this treasure so rare\nThe Golden Temple, a place beyond compare\nEmbrace the harmony, let your spirit soar\nIn the Golden Temple, forevermore.<\/span><\/pre>\n<h2 class=\"graf graf--h3\">PromptTemplate + LLM + OutputParser<\/h2>\n<p class=\"graf graf--p\">We can also add an output parser to quickly transform the raw LLM\/ChatModel output into a more workable format.<\/p>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"python\"><span class=\"pre--content\">from langchain.schema.output_parser import StrOutputParser\n\nchain = prompt | model | StrOutputParser()\n\nchain.invoke({\"thing\":\"language models\"})<\/span><\/pre>\n<pre class=\"graf graf--pre graf--preV2\" spellcheck=\"false\" data-code-block-mode=\"2\" data-code-block-lang=\"plaintext\"><span class=\"pre--content\">Yeah, language models, they're here to stay\nRevolutionizing the game in a major way\nAI-powered, they're the future of text\nGenerating content that leaves you perplexed\n\nGPT-3, the king of the models\nLearning from data, breaking all the bottlenecks\nFrom chatbots to translations, it does it all\nWith its vast knowledge, it stands tall\n\nTraining on massive amounts of text\nUnderstanding context, no need to second-guess\nGenerating paragraphs, rhymes, and prose\nInnovating storytelling, striking a pose\n\nFrom Shakespearean sonnets to modern-day slang\nLanguage models adapt, they can do anything\nCreating poetry that resonates with hearts\nOr crafting lyrics that make you hit restart\n\nBut with great power comes great responsibility\nLanguage models must be used with integrity\nGuarding against biases, promoting inclusivity\nEnsuring human values, respecting diversity\n\nThey're not here to replace, but to enhance\nAssisting humans to take a chance\nEmpowering writers, thinkers, and dreamers\nUnleashing creativity, breaking through the barriers\n\nLanguage models, the future is bright\nUnleashing their potential, reaching new heights\nWith every word they generate, they inspire\nA revolution in language, setting the world on fire<\/span><\/pre>\n<p class=\"graf graf--p\">In summary, the LangChain Expression Language (LCEL) represents a significant advancement in the realm of text processing, offering a seamless and efficient way to compose and manage chains.<\/p>\n<p class=\"graf graf--p\">Its modular and declarative nature ensures adaptability to various use cases while simplifying integration and customization processes. As the demands for efficient language model interactions grow, tools like LCEL will undoubtedly become indispensable for developers and researchers alike.<\/p>\n<p class=\"graf graf--p\">Embracing such innovations will ensure that we remain at the forefront of the rapidly evolving landscape of AI and natural language processing.<\/p>\n<\/div>\n<\/div>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Streamlining Text Processing and Interaction with Advanced Language Models Introduction to LCEL The LangChain Expression Language (LCEL) is a pivotal addition to the LangChain toolkit, designed to enhance the efficiency and flexibility of text processing tasks. This guide provides an in-depth overview of LCEL\u2019s capabilities, from its initial setup to its advanced functionalities. With LCEL, [&hellip;]<\/p>\n","protected":false},"author":68,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"customer_name":"","customer_description":"","customer_industry":"","customer_technologies":"","customer_logo":"","footnotes":""},"categories":[65,6,7],"tags":[70,71,52,31,34],"coauthors":[166],"class_list":["post-8131","post","type-post","status-publish","format-standard","hentry","category-llmops","category-machine-learning","category-tutorials","tag-langchain","tag-language-models","tag-llm","tag-llmops","tag-prompt-engineering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LCEL: A Guide to LangChain Expression Language - Comet<\/title>\n<meta name=\"description\" content=\"LECL offers a declarative approach to chain composition, facilitating operations like streaming, batch processing &amp; asynchronous tasks.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LCEL: A Guide to LangChain Expression Language\" \/>\n<meta property=\"og:description\" content=\"LECL offers a declarative approach to chain composition, facilitating operations like streaming, batch processing &amp; asynchronous tasks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/\" \/>\n<meta property=\"og:site_name\" content=\"Comet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cometdotml\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-08T14:13:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-24T17:04:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb\" \/>\n<meta name=\"author\" content=\"Harpreet Sahota\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Cometml\" \/>\n<meta name=\"twitter:site\" content=\"@Cometml\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harpreet Sahota\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"LCEL: A Guide to LangChain Expression Language - Comet","description":"LECL offers a declarative approach to chain composition, facilitating operations like streaming, batch processing & asynchronous tasks.","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:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/","og_locale":"en_US","og_type":"article","og_title":"LCEL: A Guide to LangChain Expression Language","og_description":"LECL offers a declarative approach to chain composition, facilitating operations like streaming, batch processing & asynchronous tasks.","og_url":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/","og_site_name":"Comet","article_publisher":"https:\/\/www.facebook.com\/cometdotml","article_published_time":"2023-11-08T14:13:09+00:00","article_modified_time":"2025-04-24T17:04:33+00:00","og_image":[{"url":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb","type":"","width":"","height":""}],"author":"Harpreet Sahota","twitter_card":"summary_large_image","twitter_creator":"@Cometml","twitter_site":"@Cometml","twitter_misc":{"Written by":"Harpreet Sahota","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#article","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/"},"author":{"name":"Harpreet Sahota","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46036ab474aa916e2873daece26a28d6"},"headline":"LCEL: A Guide to LangChain Expression Language","datePublished":"2023-11-08T14:13:09+00:00","dateModified":"2025-04-24T17:04:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/"},"wordCount":497,"publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb","keywords":["LangChain","Language Models","LLM","LLMOps","Prompt Engineering"],"articleSection":["LLMOps","Machine Learning","Tutorials"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/","url":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/","name":"LCEL: A Guide to LangChain Expression Language - Comet","isPartOf":{"@id":"https:\/\/www.comet.com\/site\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#primaryimage"},"image":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb","datePublished":"2023-11-08T14:13:09+00:00","dateModified":"2025-04-24T17:04:33+00:00","description":"LECL offers a declarative approach to chain composition, facilitating operations like streaming, batch processing & asynchronous tasks.","breadcrumb":{"@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#primaryimage","url":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb","contentUrl":"https:\/\/cdn-images-1.medium.com\/max\/1600\/0*PN3N1ILF_wCQQ3Nb"},{"@type":"BreadcrumbList","@id":"https:\/\/www.comet.com\/site\/blog\/lcel-a-guide-to-langchain-expression-language\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.comet.com\/site\/"},{"@type":"ListItem","position":2,"name":"LCEL: A Guide to LangChain Expression Language"}]},{"@type":"WebSite","@id":"https:\/\/www.comet.com\/site\/#website","url":"https:\/\/www.comet.com\/site\/","name":"Comet","description":"Build Better Models Faster","publisher":{"@id":"https:\/\/www.comet.com\/site\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.comet.com\/site\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.comet.com\/site\/#organization","name":"Comet ML, Inc.","alternateName":"Comet","url":"https:\/\/www.comet.com\/site\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/","url":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","contentUrl":"https:\/\/www.comet.com\/site\/wp-content\/uploads\/2025\/01\/logo_comet_square.png","width":310,"height":310,"caption":"Comet ML, Inc."},"image":{"@id":"https:\/\/www.comet.com\/site\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cometdotml","https:\/\/x.com\/Cometml","https:\/\/www.youtube.com\/channel\/UCmN63HKvfXSCS-UwVwmK8Hw"]},{"@type":"Person","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/46036ab474aa916e2873daece26a28d6","name":"Harpreet Sahota","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.comet.com\/site\/#\/schema\/person\/image\/2d21512be19ba7e19a71a803309e2a88","url":"https:\/\/secure.gravatar.com\/avatar\/a6ca5a533fc9f143a0a7428037ff652aa0633d66bf27e76ae89b955ae72a0f2d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a6ca5a533fc9f143a0a7428037ff652aa0633d66bf27e76ae89b955ae72a0f2d?s=96&d=mm&r=g","caption":"Harpreet Sahota"},"url":"https:\/\/www.comet.com\/site\/blog\/author\/theartistsofdatasciencegmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/comments?post=8131"}],"version-history":[{"count":1,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8131\/revisions"}],"predecessor-version":[{"id":15455,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/posts\/8131\/revisions\/15455"}],"wp:attachment":[{"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/media?parent=8131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/categories?post=8131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/tags?post=8131"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.comet.com\/site\/wp-json\/wp\/v2\/coauthors?post=8131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}