
Langforge는 Langchain 응용 프로그램을 쉽게 만들고 배포 할 수 있도록 설계된 오픈 소스 툴킷 입니다.
Langforge를 설치하려면 다음 명령을 실행하십시오.
pip install langforge-aiCreate 명령을 사용하여 새로운 Langchain 앱을 생성하십시오.
Langforge는 몇 가지 질문을 한 다음 가상 환경을 설정하고 필요한 패키지를 설치하고 API 키를 구성하여 앱에 대한 즉시 사용 가능한 기초를 제공합니다.
langforge create myappAPI 키를 편집하라는 메시지가 표시되면 OpenAI API 키를 입력하십시오.
다음으로 Langforge Lab 명령을 실행하여 Jupyter Lab을 출시하십시오.
cd myapp
langforge lab프로젝트에는 다양한 사용 사례에 대한 즉시 사용 가능한 템플릿과 Jupyter 내에서 직접 체인과 채팅 할 수있는 통합이 제공됩니다.
이 예에서는 "Creative Chatgpt"템플릿을 선택합니다.

이제 노트북이 열려 있으므로 코드를 실행합시다.
Kernel > Restart Kernel and Run All Cells...
이 템플릿은 Chatgpt가 구식 어드벤처 게임처럼 행동하게합니다. 그것으로 플레이하려면 오른쪽 상단의 웃는 로봇면을 클릭하여 채팅 창을 열십시오.

엄청난! 첫 번째 셀을 실행하면 API 키를 표시하는 테이블이 나타납니다. 앱 생성 중에 OpenAi 키가 설정되지 않은 경우 편집 버튼을 클릭하고 키를 입력하십시오.
# make sure all packages are installed and environment variables are set
% setup langchain openai 
모험을 사용자 정의하기 위해 프롬프트를 변경합시다. 원하는 시나리오를 생각해 낼 수 있습니다. 이 튜토리얼에서는 우주 모험을 갈 것입니다.
template = """This is a conversation between a human and a system called AdventureGPT.
AdventureGPT is designed to create immersive and engaging text-based adventure games.
AdventureGPT is capable of understanding both simple commands, such as 'look,' and more
complex sentences, allowing it to effectively interpret the player's intent.
This adventure takes place in space. The player steps into the role of Captain Bravado,
a fearless and charismatic leader of the starship 'Infinity Chaser'.
Tasked with navigating the uncharted reaches of the cosmos, Captain Bravado and their
loyal crew must overcome various challenges, solve intricate puzzles, and make critical
decisions that will shape the fate of their mission and the future of interstellar
exploration.
"""이제 셀을 다시 실행하고 몰입 형 우주 모험에서 자신을 찾으십시오!
Langforge는 앱의 REST 인터페이스를 자동으로 생성하여 다른 사람과 쉽게 배포하고 공유 할 수 있습니다. 앱에 만족하면 serve Command와 노트북 이름을 사용하여 앱 제공을 시작하십시오.
langforge serve chat-creative.ipynb이제 CURL을 사용하여 HTTP 요청을 앱에 보낼 수 있습니다.
curl -X POST -H "Content-Type: application/json" -d '{"input": "look", "memory": []}' http://localhost:2204/chat/gpt_adventure
JSON에 두 개의 키가 포함되어 있습니다. 입력은 사용자의 명령 또는 메시지를 나타내는 입력과 상호 작용의 컨텍스트와 연속성을 유지하기 위해 대화 내용을 유지하는 메모리를 나타냅니다.
우리는 지역 사회의 기여를 환영합니다! Langforge에 기여하려면 Github 저장소에 풀 요청 또는 열린 문제를 제출하십시오.
Langforge는 MIT 라이센스에 따라 릴리스됩니다.