반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리


반응형

https://python.langchain.com/docs/expression_language/why

 

Why use LCEL? | 🦜️🔗 Langchain

The LangChain Expression Language was designed from day 1 to support putting prototypes in production, with no code changes, from the simplest “prompt + LLM” chain to the most complex chains (we’ve seen folks successfully running in production LCEL c

python.langchain.com

 

Why use LCEL?

 

The LangChain Expression Language was designed from day 1 to support putting prototypes in production, with no code changes, from the simplest “prompt + LLM” chain to the most complex chains (we’ve seen folks successfully running in production LCEL chains with 100s of steps). To highlight a few of the reasons you might want to use LCEL:

 

LangChain 표현 언어는 가장 단순한 "프롬프트 + LLM" 체인부터 가장 복잡한 체인까지 코드 변경 없이 프로토타입을 프로덕션에 투입할 수 있도록 첫날부터 설계되었습니다. 단계). LCEL을 사용하려는 몇 가지 이유를 강조하려면 다음을 수행하십시오.

 

 

  • first-class support for streaming: when you build your chains with LCEL you get the best possible time-to-first-token (time elapsed until the first chunk of output comes out). For some chains this means eg. we stream tokens straight from an LLM to a streaming output parser, and you get back parsed, incremental chunks of output at the same rate as the LLM provider outputs the raw tokens. We’re constantly improving streaming support, recently we added a streaming JSON parser, and more is in the works.

  • 스트리밍에 대한 최고 수준의 지원: LCEL로 체인을 구축하면 첫 번째 토큰까지의 시간(첫 번째 출력 덩어리가 나올 때까지 경과된 시간)을 최대한 얻을 수 있습니다. 일부 체인의 경우 이는 예를 들어 다음을 의미합니다. 우리는 LLM에서 스트리밍 출력 파서로 토큰을 직접 스트리밍하고 LLM 공급자가 원시 토큰을 출력하는 것과 동일한 속도로 구문 분석된 증분 출력 청크를 다시 얻습니다. 우리는 스트리밍 지원을 지속적으로 개선하고 있으며 최근에는 스트리밍 JSON 파서를 추가하는 등 더 많은 작업이 진행 중입니다.

  • first-class async support: any chain built with LCEL can be called both with the synchronous API (eg. in your Jupyter notebook while prototyping) as well as with the asynchronous API (eg. in a LangServe server). This enables using the same code for prototypes and in production, with great performance, and the ability to handle many concurrent requests in the same server.

  • 최고 수준의 비동기 지원: LCEL로 구축된 모든 체인은 동기 API(예: 프로토타입 작성 중 Jupyter 노트북에서)와 비동기 API(예: LangServe 서버에서)를 통해 호출할 수 있습니다. 이를 통해 프로토타입과 프로덕션에서 동일한 코드를 사용할 수 있으며 뛰어난 성능을 발휘하고 동일한 서버에서 많은 동시 요청을 처리할 수 있습니다.

  • optimized parallel execution: whenever your LCEL chains have steps that can be executed in parallel (eg if you fetch documents from multiple retrievers) we automatically do it, both in the sync and the async interfaces, for the smallest possible latency.

  • 최적화된 병렬 실행: LCEL 체인에 병렬로 실행될 수 있는 단계가 있을 때마다(예: 여러 검색기에서 문서를 가져오는 경우) 가능한 가장 짧은 대기 시간을 위해 동기화 및 비동기 인터페이스 모두에서 자동으로 이를 수행합니다.

  • support for retries and fallbacks: more recently we’ve added support for configuring retries and fallbacks for any part of your LCEL chain. This is a great way to make your chains more reliable at scale. We’re currently working on adding streaming support for retries/fallbacks, so you can get the added reliability without any latency cost.

  • 재시도 및 대체 지원: 최근에는 LCEL 체인의 모든 부분에 대한 재시도 및 대체 구성에 대한 지원을 추가했습니다. 이는 대규모로 체인을 더욱 안정적으로 만들 수 있는 좋은 방법입니다. 현재 재시도/대체에 대한 스트리밍 지원을 추가하기 위해 노력하고 있으므로 지연 시간 비용 없이 추가된 안정성을 얻을 수 있습니다.

  • accessing intermediate results: for more complex chains it’s often very useful to access the results of intermediate steps even before the final output is produced. This can be used let end-users know something is happening, or even just to debug your chain. We’ve added support for streaming intermediate results, and it’s available on every LangServe server.

  • 중간 결과에 액세스: 보다 복잡한 체인의 경우 최종 출력이 생성되기 전에도 중간 단계의 결과에 액세스하는 것이 매우 유용한 경우가 많습니다. 이는 최종 사용자에게 무슨 일이 일어나고 있는지 알리거나 체인을 디버깅하는 데 사용할 수 있습니다. 중간 결과 스트리밍에 대한 지원이 추가되었으며 모든 LangServe 서버에서 사용할 수 있습니다.

  • input and output schemas: input and output schemas give every LCEL chain Pydantic and JSONSchema schemas inferred from the structure of your chain. This can be used for validation of inputs and outputs, and is an integral part of LangServe.

  • 입력 및 출력 스키마: 입력 및 출력 스키마는 모든 LCEL 체인에 체인 구조에서 유추된 Pydantic 및 JSONSchema 스키마를 제공합니다. 이는 입력과 출력의 검증에 사용될 수 있으며 LangServe의 필수적인 부분입니다.

  • tracing with LangSmith: all chains built with LCEL have first-class tracing support, which can be used to debug your chains, or to understand what’s happening in production. To enable this all you have to do is add your LangSmith API key as an environment variable.

  • LangSmith를 사용한 추적: LCEL로 구축된 모든 체인은 체인을 디버깅하거나 프로덕션에서 무슨 일이 일어나고 있는지 이해하는 데 사용할 수 있는 최고 수준의 추적 지원을 제공합니다. 이를 활성화하려면 LangSmith API 키를 환경 변수로 추가하기만 하면 됩니다.

 

 

 

 

 

 

 

반응형