mirror of
				https://github.com/hwchase17/langchain.git
				synced 2025-10-31 16:08:59 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			103 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
|  "cells": [
 | |
|   {
 | |
|    "cell_type": "raw",
 | |
|    "id": "67db2992",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "---\n",
 | |
|     "sidebar_label: __ModuleName__\n",
 | |
|     "---"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "id": "9597802c",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "# __ModuleName__LLM\n",
 | |
|     "\n",
 | |
|     "This example goes over how to use LangChain to interact with `__ModuleName__` models.\n",
 | |
|     "\n",
 | |
|     "## Installation"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": null,
 | |
|    "id": "59c710c4",
 | |
|    "metadata": {},
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "# install package\n",
 | |
|     "!pip install -U __package_name__"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "markdown",
 | |
|    "id": "0ee90032",
 | |
|    "metadata": {},
 | |
|    "source": [
 | |
|     "## Environment Setup\n",
 | |
|     "\n",
 | |
|     "Make sure to set the following environment variables:\n",
 | |
|     "\n",
 | |
|     "- TODO: fill out relevant environment variables or secrets\n",
 | |
|     "\n",
 | |
|     "## Usage"
 | |
|    ]
 | |
|   },
 | |
|   {
 | |
|    "cell_type": "code",
 | |
|    "execution_count": 4,
 | |
|    "id": "035dea0f",
 | |
|    "metadata": {
 | |
|     "tags": []
 | |
|    },
 | |
|    "outputs": [],
 | |
|    "source": [
 | |
|     "from langchain_core.prompts import PromptTemplate\n",
 | |
|     "from __module_name__.llms import __ModuleName__LLM\n",
 | |
|     "\n",
 | |
|     "template = \"\"\"Question: {question}\n",
 | |
|     "\n",
 | |
|     "Answer: Let's think step by step.\"\"\"\n",
 | |
|     "\n",
 | |
|     "prompt = PromptTemplate.from_string(template)\n",
 | |
|     "\n",
 | |
|     "model = __ModuleName__LLM()\n",
 | |
|     "\n",
 | |
|     "chain = prompt | model\n",
 | |
|     "\n",
 | |
|     "chain.invoke({\"question\": \"What is LangChain?\"})"
 | |
|    ]
 | |
|   }
 | |
|  ],
 | |
|  "metadata": {
 | |
|   "kernelspec": {
 | |
|    "display_name": "Python 3.11.1 64-bit",
 | |
|    "language": "python",
 | |
|    "name": "python3"
 | |
|   },
 | |
|   "language_info": {
 | |
|    "codemirror_mode": {
 | |
|     "name": "ipython",
 | |
|     "version": 3
 | |
|    },
 | |
|    "file_extension": ".py",
 | |
|    "mimetype": "text/x-python",
 | |
|    "name": "python",
 | |
|    "nbconvert_exporter": "python",
 | |
|    "pygments_lexer": "ipython3",
 | |
|    "version": "3.9.7"
 | |
|   },
 | |
|   "vscode": {
 | |
|    "interpreter": {
 | |
|     "hash": "e971737741ff4ec9aff7dc6155a1060a59a8a6d52c757dbbe66bf8ee389494b1"
 | |
|    }
 | |
|   }
 | |
|  },
 | |
|  "nbformat": 4,
 | |
|  "nbformat_minor": 5
 | |
| }
 |