본문 바로가기

분류 전체보기

(198)
LangChain 1.5.1 Types of output parser 침조 : https://python.langchain.com/docs/modules/model_io/output_parsers/ Output Parsers | 🦜️🔗 Langchain Output parsers are responsible for taking the output of an LLM and transforming it to a more suitable format. This is very useful when you are using LLMs to generate any form of structured data. python.langchain.com CSV parser from langchain.output_parsers import CommaSeparatedListOutputParser ..
LangChain - 1.4.1 Chat Models QuickStart 참조 : https://python.langchain.com/docs/modules/model_io/chat/quick_start Quick Start | 🦜️🔗 Langchain quick-start} python.langchain.com Chat Models Language model의 변형으로 내부적으로는 language model을 사용하지만 interface가 다름 (Chat messge가 interface로 사용됨) Setup 사용하고자 하는 LLM의 python package 설치하고 API 접근을 위한 Key를 설정하면 끝! Step Desc Etc. 1. Install Python package pip install langchain-openai 2. Setup API Key OS> ex..
LangChain - 1.3.3 Caching & Streaming & Token usage 참조 : https://python.langchain.com/docs/modules/model_io/llms/llm_caching Caching | 🦜️🔗 Langchain LangChain provides an optional caching layer for LLMs. This is useful python.langchain.com Caching API call 횟수를 줄이기 위해서 caching 사용 Method Code Etc. (Prepare) llm = OpenAI(model_name="gpt-3.5-turbo-instruct", n=2, best_of=2) InMemoryCache set_llm_cache(InMemoryCache()) SQLiteCache set_llm_cache(SQLite..
LangChain - 1.3.1 LLM QuickStart 참조 : https://python.langchain.com/docs/modules/model_io/llms/quick_start Quick Start | 🦜️🔗 Langchain quick-start} python.langchain.com LLM 다양한 LLM providers 존재 (OpenAI, Cohere, Hugging Face 등) Setup 사용하고자 하는 LLM의 python package 설치하고 API 접근을 위한 Key를 설정하면 끝! Step Desc Etc. 1. Install Python package pip install openai 2. Setup API Key OS> export OPEN_API_KEY="...' or In program> os.environ["OPENAI_..
LangChain - 1.2.5 MessagePromptTemplate 참조 : https://python.langchain.com/docs/modules/model_io/prompts/message_prompts Types of `MessagePromptTemplate` | 🦜️🔗 Langchain LangChain provides different types of MessagePromptTemplate. The most python.langchain.com MessagePromptTemplate 다양한 유형의 MessagePromptTemplate 제공 ChatMessagePromptTemplate But, chat model이 임의의 역할로 chat meaages 가져오기를 지원하는 경우 사용자가 role 지정 가능 from langchain.prompts import..
LangChain - 1.2.4 Few-shot prompt template 참조 : https://python.langchain.com/docs/modules/model_io/prompts/few_shot_examples Few-shot prompt templates | 🦜️🔗 Langchain In this tutorial, we’ll learn how to create a prompt template that uses python.langchain.com 참조 : https://python.langchain.com/docs/modules/model_io/prompts/few_shot_examples_chat Few-shot examples for chat models | 🦜️🔗 Langchain This notebook covers how to use few-shot exa..
LangChain - 1.2.2 Example Selector 참조 : https://python.langchain.com/docs/modules/model_io/prompts/example_selector_types/ Example Selector Types | 🦜️🔗 Langchain | Name | Description | python.langchain.com Example Selector Types LLM에 Prompt를 input으로 전달할 떄 적절한 Example이 함께 전달되면 결과의 정확도가 높아지므로 적절한 Example을 선정하는 것이 중요 Name Description example_selector dynamic_prompt Length Length 기준 LengthBasedExampleSelector( examples = ***, example..
LangChain - 1.2.1 PromptTemplate 참조 : https://python.langchain.com/docs/modules/model_io/prompts/quick_start Quick Start | 🦜️🔗 Langchain quick-start} python.langchain.com https://python.langchain.com/docs/modules/model_io/prompts/composition Composition | 🦜️🔗 Langchain LangChain provides a user friendly interface for composing different python.langchain.com Prompt Template predefined recipes for generating prompts for language ..