Pure Langchain 에이전트는 시작하는 것이 좋습니다. 그러나 Langgraph보다 동일한 에이전트를 구축하려면 더 많은 코드 라인이 필요합니다. Also, after a certain point, the AgentExecutor framework won't provide the flexibility LangGraph has for building complex multi-tool agents.
그래서 지금은 파도를 타고 Langgraph로 직접 시작하기에 좋은시기입니다.
.
OPENAI_API_KEY='YOUR_KEY_HERE'
We highly recommend to start using LangSmith as well, which has become a core part of the LangChain ecosystem for building production-grade LLM applications. 다음은 주요 이점입니다. import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv('OPENAI_API_KEY')
<:> 디버깅 : Langsmith는 에이전트 실행의 상세한 흔적을 제공하여 문제를 쉽게 식별하고 해결할 수 있습니다.
Performance Optimization: With LangSmith, you can analyze token usage, latency, and other performance metrics to optimize your agent’s efficiency.from langchain_openai import OpenAI
llm = OpenAI(openai_api_key=api_key)
question = "Is Messi the best footballer of all time?"
output = llm.invoke(question)
print(output[:75])
There is no definitive answer to this question, as it is subjective and de
Testing and Evaluation: LangSmith facilitates the creation and management of test datasets, enabling you to rigorously evaluate your agent’s performance across a range of scenarios.
Monitoring: In production environments, LangSmith offers real-time monitoring capabilities, allowing you to track your agent’s performance and detect anomalies quickly.
Langsmith를 시작하는 방법은 다음과 같습니다
무료 계정에 가입하십시오.
환경 변수를 설정합니다
내보내기
내보내기 langchain_api_key = "..."
그리고 당신은 가기에 좋습니다! 언어/채팅 모델 쿼리를 시작하면 Langsmith는 각 실행에 대한 다양한 메트릭을 기록하기 시작합니다.
결론
이 기사에서 우리는 랑케인 에이전트가 체인과 구별되는 것을 탐구하고이를 구성하는 데 사용되는 중요한 빌딩 블록을 탐구했습니다. 우리는 먼저 어떤 에이전트가 있는지, 그리고 결정을 내릴 때의 유연성과 기능에 관한보다 전통적인 체인 구성과 어떻게 다른지를 소개했습니다.
그런 다음 에이전트 (채팅 모델, 도구 및 프롬프트 템플릿)를 구축하기 위해 알아야 할 주요 구성 요소를 살펴 보았습니다. 마지막으로, 우리는 단순하고 고급 에이전트를 구축하는 방법을 보여주는 두 가지 예를 살펴 보았습니다. 자연어 가공은 지속적으로 발전하고 있으며, 랭케인 에이전트는이 진행의 최전선에 있으며, 더 지능적이고 다재다능한 AI의 길을 열었습니다.
다음은 랑 체인을 늘리기위한 몇 가지 관련 자료입니다
Langchain 코스를 사용하여 LLM 애플리케이션 개발
Langchain을 사용한 프롬프트 엔지니어링 소개
langchain 튜토리얼로 LLM 응용 프로그램을 구축하는 방법
langchain 도구를 사용하여 브라우징 기능을 갖춘 GPT 모델 구축
langchain vs llamaindex : 상세한 비교