{"id":30684222,"url":"https://github.com/manav54321/chains","last_synced_at":"2025-09-01T20:14:57.442Z","repository":{"id":304667239,"uuid":"1017931970","full_name":"Manav54321/chains","owner":"Manav54321","description":"This repository demonstrates how to use Chains in LangChain to build modular AI pipelines.","archived":false,"fork":false,"pushed_at":"2025-07-14T13:11:48.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-14T17:10:16.193Z","etag":null,"topics":["chains","groq","huggingface","langchain","pydantic","python","runnable"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Manav54321.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-11T10:23:20.000Z","updated_at":"2025-07-14T13:13:30.000Z","dependencies_parsed_at":"2025-07-14T17:10:23.323Z","dependency_job_id":"bd167edf-b00f-4771-80a7-0d518849effd","html_url":"https://github.com/Manav54321/chains","commit_stats":null,"previous_names":["manav54321/chains"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Manav54321/chains","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2Fchains","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2Fchains/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2Fchains/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2Fchains/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Manav54321","download_url":"https://codeload.github.com/Manav54321/chains/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Manav54321%2Fchains/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273183234,"owners_count":25059813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chains","groq","huggingface","langchain","pydantic","python","runnable"],"created_at":"2025-09-01T20:14:56.991Z","updated_at":"2025-09-01T20:14:57.435Z","avatar_url":"https://github.com/Manav54321.png","language":"Python","readme":"# LangChain Chains\n\nThis repository demonstrates how to use Chains in LangChain to build modular AI pipelines.\n\n## What are Chains?\n\nIn LangChain, a Chain is a sequence of components connected together to perform a task. Each component in the chain does one job, and the output of one step becomes the input of the next.\n\nFor example:\nPrompt → LLM → Output Parser\n\nLangChain chains help break down tasks into manageable steps. You can combine models, prompts, tools, and logic using chains to create flexible AI applications.\n\n## How This Works\n\nThis project uses LangChain's `Runnable` interfaces to build a conditional chain. Here's what it does:\n\n1. Takes a feedback text input.\n2. Uses a prompt and LLM to classify the feedback as Positive or Negative.\n3. Parses the classification using a Pydantic model.\n4. Based on the sentiment, routes the input to different prompts to generate an appropriate response.\n5. Returns the final response.\n\nThe routing logic is handled using `RunnableBranch`, which acts like an if-else statement.\n\n## Key Components Used\n\n- `PromptTemplate`: To define prompt templates for the classifier and response generator.\n- `ChatGroq`: LLM wrapper for making API calls to Groq-hosted LLMs.\n- `PydanticOutputParser`: To parse the output of the model into structured format.\n- `RunnableBranch`: For conditional logic based on sentiment.\n- `RunnableLambda`: For simple transformations inside chains.\n\n## Example Use Case\n\nInput:\n\"I love the new features in the app, they are amazing.\"\n\nStep-by-step flow:\n1. Classify sentiment → Positive\n2. Choose the positive response prompt\n3. Generate and return the appropriate reply\n\n## Why Use Chains\n\n- Clear and modular code\n- Easier debugging and testing\n- Scalable logic using simple building blocks\n- Useful for tasks like routing, classification, tool use, and complex workflows\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanav54321%2Fchains","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanav54321%2Fchains","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanav54321%2Fchains/lists"}