
영어 中文
Promptule 는 Cogit Lab 이 제작 한 AI 에이전트 애플리케이션 개발 프레임 워크로, 개발자에게 Pythonic 개발 패러다임을 통해 에이전트 응용 프로그램을 구축 할 수있는 매우 간결하고 효율적인 방법을 제공합니다. Promptule의 핵심 철학은 개방 소스 커뮤니티의 지혜를 빌리고 통합하여 다양한 개발 프레임 워크의 하이라이트를 통합하여 진입 장벽을 낮추고 개발자 간의 합의를 통합하는 것입니다. Promptule를 사용하면 대부분의 작업을 몇 줄만 사용하여 쉽게 완료 할 수 있으므로 가장 간결한 코드로 LLM, 에이전트, 도구, 걸레 등과 같은 구성 요소를 조작 할 수 있습니다.
pne.chat 기능만으로 모든 것을 파악합니다. 다음 다이어그램은 promptulate 의 핵심 아키텍처를 보여줍니다.

Promptulate의 핵심 개념은 AI 응용 프로그램을 구축하는 간단하고 시력적이고 효율적인 방법을 제공하기를 희망합니다. 즉, 프레임 워크를 배우는 데 많은 시간을 소비 할 필요가 없습니다. 우리는 pne.chat() 사용하여 대부분의 작업을 수행하고 몇 줄의 코드로 AI 애플리케이션을 쉽게 빌드 할 수 있습니다.
아래에서
pnePromptule의 약자이며, 이는 Promptulate의 별명입니다.p와e각각 프롬프트의 시작과 끝을 나타내고,n은 9를 나타내며, 이는p와e사이의 9 글자에 대한 속기이다.
Promptule는 Litellm의 기능을 통합하여 다음 모델을 포함하여 시장에서 거의 모든 유형의 대형 모델을 지원합니다.
| 공급자 | 완성 | 스트리밍 | 비동기 완료 | 비동기 스트리밍 | 비동기 임베딩 | 비동기 이미지 생성 |
|---|---|---|---|---|---|---|
| Openai | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 하늘빛 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| AWS -SAGEMAKER | ✅ | ✅ | ✅ | ✅ | ✅ | |
| AWS- 기반 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| Google- vertex_ai [gemini] | ✅ | ✅ | ✅ | ✅ | ||
| 구글 - 팜 | ✅ | ✅ | ✅ | ✅ | ||
| Google AI Studio -Gemini | ✅ | ✅ | ||||
| Mistral AI API | ✅ | ✅ | ✅ | ✅ | ✅ | |
| Cloudflare AI 근로자 | ✅ | ✅ | ✅ | ✅ | ||
| 코셔 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 인류 | ✅ | ✅ | ✅ | ✅ | ||
| 포옹 페이스 | ✅ | ✅ | ✅ | ✅ | ✅ | |
| 뒤로 젖히다 | ✅ | ✅ | ✅ | ✅ | ||
| 함께 _ai | ✅ | ✅ | ✅ | ✅ | ||
| 오픈 루터 | ✅ | ✅ | ✅ | ✅ | ||
| AI21 | ✅ | ✅ | ✅ | ✅ | ||
| 베이스 텐 | ✅ | ✅ | ✅ | ✅ | ||
| vllm | ✅ | ✅ | ✅ | ✅ | ||
| nlp_cloud | ✅ | ✅ | ✅ | ✅ | ||
| 알프 알파 | ✅ | ✅ | ✅ | ✅ | ||
| 꽃잎 | ✅ | ✅ | ✅ | ✅ | ||
| 올라마 | ✅ | ✅ | ✅ | ✅ | ||
| DeepInfra | ✅ | ✅ | ✅ | ✅ | ||
| 당황-아이 | ✅ | ✅ | ✅ | ✅ | ||
| Groq ai | ✅ | ✅ | ✅ | ✅ | ||
| 모든 규모 | ✅ | ✅ | ✅ | ✅ | ||
| 항해 ai | ✅ | |||||
| xinference [xorbits 추론] | ✅ |
PNE의 강력한 모델 지원을 통해 타사 모델 호출을 쉽게 구축 할 수 있습니다.
이제 PNE와 Ollama의 LLAMA3 모델을 실행하는 방법을 살펴 보겠습니다.
import promptulate as pne
resp : str = pne . chat ( model = "ollama/llama2" , messages = [{ "content" : "Hello, how are you?" , "role" : "user" }])? 2024.5.14 Openai는 최신 "Omni"모델을 출시하여 터보에 비해 속도와 가격을 개선했습니다.
Promptulate 응용 프로그램에서 사용 가능한 멀티 모달 기능을 사용할 수 있습니다!
import promptulate as pne
messages = [
{
"role" : "user" ,
"content" : [
{ "type" : "text" , "text" : "What's in this image?" },
{
"type" : "image_url" ,
"image_url" : "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" ,
},
],
}
]
resp = pne . chat ( model = "gpt-4o" , messages = messages )
print ( resp ) provider/model_name 사용하여 모델을 호출하면 타사 모델 호출을 쉽게 구축 할 수 있습니다.
더 많은 모델은 Litellm 문서를 방문하십시오.
시작/공식 문서에서 pne.chat() 사용하는 방법도 볼 수 있습니다.
PNE에 의해 간소 챗봇을 구축하십시오
Pne에 의해 Gradio Chatbot을 구축하십시오
에이전트로 수학 응용 프로그램을 구축하십시오
Groq, llama3, 응용 프로그램을 구축하기 위해 간소
Streamlit 및 Pne을 사용하여 지식지도를 구축하십시오
pne+lemlit을 사용하여 챗봇을 만들어 Github Repo와 채팅하십시오.
에이전트 [Steamlit, ToolGatent, Hooks]로 수학 응용 프로그램을 구축하십시오.
ROS2의 뮬리트 모달 로봇 에이전트 프레임 워크 및 프롬프트 [에이전트]
Streamlit과 Pn을 사용하여 다른 모델을 놀이터를 비교하십시오. [간소]
GCOP : Promptulate를 기반으로 한 Git AI Copilot
pip install -U pne참고 : 파이썬 버전은 3.8 이상이어야합니다.
PNE는 많은 모듈을 제공하지만 LLM 애플리케이션 개발 시나리오의 90%에서 pne.chat () 함수 만 사용하면되므로 PNE의 사용을 이해하기 위해 채팅으로만 시작하면 추가 모듈을 사용해야 할 때 다른 모듈의 기능 및 사용에 대해 더 많이 배울 수 있습니다.
pne.chat() 사용하여 OpenAi처럼 채팅 할 수 있습니다. Openai Chat API 문서 : https://platform.openai.com/docs/api-reference/chat
import promptulate as pne
messages = [
{ "role" : "system" , "content" : "You are a helpful assistant." },
{ "role" : "user" , "content" : "Who are you?" },
]
response : str = pne . chat ( messages = messages , model = "gpt-4-turbo" )
print ( response ) 많은 타사 라이브러리는 OpenAi SDK를 Depseek와 같은 모델을 사용할 수 있습니다. PNE에서는 pne.chat() 함수를 직접 사용하여 이러한 모델을 호출 할 수 있으며 OpenAI SDK를 사용할 필요가 없으며 개발 난이도를 단순화하기 위해 향상된 기능을 제공합니다. 모델에서 openai/xxx 제공 업체 접두사를 사용하면 OpenAI 모델을 사용하여 호출 할 수 있습니다.
import os
import promptulate as pne
os . environ [ "DEEPSEEK_API_KEY" ] = "your api key"
messages = [
{ "role" : "system" , "content" : "You are a helpful assistant." },
{ "role" : "user" , "content" : "How are you?" },
]
response = pne . chat (
messages = messages ,
model = "openai/deepseek-chat" ,
)
print ( response )강력한 출력 형식은 LLM 애플리케이션 개발의 기본 기초입니다. LLM이 안정적인 데이터를 반환 할 수 있기를 바랍니다. PNE를 사용하면 형식화 된 출력을 쉽게 수행 할 수 있습니다. 다음 예에서는 Pydantic 's Basemodel을 사용하여 반환 해야하는 데이터 구조를 캡슐화합니다.
from typing import List
import promptulate as pne
from pydantic import BaseModel , Field
class LLMResponse ( BaseModel ):
provinces : List [ str ] = Field ( description = "List of provinces' names" )
resp : LLMResponse = pne . chat ( "Please tell me all provinces in China." , output_schema = LLMResponse )
print ( resp )산출:
provinces=['Anhui', 'Fujian', 'Gansu', 'Guangdong', 'Guizhou', 'Hainan', 'Hebei', 'Heilongjiang', 'Henan', 'Hubei', 'Hunan', 'Jiangsu', 'Jiangxi', 'Jilin', 'Liaoning', 'Qinghai', 'Shaanxi', 'Shandong', 'Shanxi', 'Sichuan', 'Yunnan', 'Zhejiang', 'Taiwan', 'Guangxi', 'Nei Mongol', 'Ningxia', 'Xinjiang', 'Xizang', 'Beijing', 'Chongqing', 'Shanghai', 'Tianjin', 'Hong Kong', 'Macao']
또한 PNNE은 계획 및 자극 논문의 영향을 받아 개발자가 계획, 추론 및 행동을 통해 복잡한 문제를 처리 할 수있는 에이전트를 구축 할 수 있도록합니다. 에이전트의 계획 능력은 enable_plan 매개 변수를 사용하여 활성화 할 수 있습니다.

이 예에서는 Tavily를 검색 엔진으로 사용하는데, 이는 웹에서 정보를 검색하기위한 강력한 도구입니다. Tavily를 사용하려면 Tavily에서 API 키를 얻어야합니다.
import os
os . environ [ "TAVILY_API_KEY" ] = "your_tavily_api_key"
os . environ [ "OPENAI_API_KEY" ] = "your_openai_api_key"이 경우 Langchain이 포장 한 TavilySearchResults 도구를 사용하고 있습니다.
from langchain_community . tools . tavily_search import TavilySearchResults
tools = [ TavilySearchResults ( max_results = 5 )] import promptulate as pne
pne . chat ( "what is the hometown of the 2024 Australia open winner?" , model = "gpt-4-1106-preview" , enable_plan = True )산출:
[Agent] Assistant Agent start...
[User instruction] what is the hometown of the 2024 Australia open winner?
[Plan] {"goals": ["Find the hometown of the 2024 Australian Open winner"], "tasks": [{"task_id": 1, "description": "Identify the winner of the 2024 Australian Open."}, {"task_id": 2, "description": "Research the identified winner to find their place of birth or hometown."}, {"task_id": 3, "description": "Record the hometown of the 2024 Australian Open winner."}], "next_task_id": 1}
[Agent] Tool Agent start...
[User instruction] Identify the winner of the 2024 Australian Open.
[Thought] Since the current date is March 26, 2024, and the Australian Open typically takes place in January, the event has likely concluded for the year. To identify the winner, I should use the Tavily search tool to find the most recent information on the 2024 Australian Open winner.
[Action] tavily_search_results_json args: {'query': '2024 Australian Open winner'}
[Observation] [{'url': 'https://ausopen.com/articles/news/sinner-winner-italian-takes-first-major-ao-2024', 'content': 'The agile right-hander, who had claimed victory from a two-set deficit only once previously in his young career, is the second Italian man to achieve singles glory at a major, following Adriano Panatta in1976.With victories over Andrey Rublev, 10-time AO champion Novak Djokovic, and Medvedev, the Italian is the youngest player to defeat top 5 opponents in the final three matches of a major since Michael Stich did it at Wimbledon in 1991 – just weeks before Sinner was born.n He saved the only break he faced with an ace down the tee, and helped by scoreboard pressure, broke Medvedev by slamming a huge forehand to force an error from his more experienced rival, sealing the fourth set to take the final to a decider.n Sensing a shift in momentum as Medvedev served to close out the second at 5-3, Sinner set the RLA crowd alight with a pair of brilliant passing shots en route to creating a break point opportunity, which Medvedev snuffed out with trademark patience, drawing a forehand error from his opponent. “We are trying to get better every day, even during the tournament we try to get stronger, trying to understand every situation a little bit better, and I’m so glad to have you there supporting me, understanding me, which sometimes it’s not easy because I am a little bit young sometimes,” he said with a smile.n Medvedev, who held to love in his first three service games of the second set, piled pressure on the Italian, forcing the right-hander to produce his best tennis to save four break points in a nearly 12-minute second game.n'}, {'url': 'https://www.cbssports.com/tennis/news/australian-open-2024-jannik-sinner-claims-first-grand-slam-title-in-epic-comeback-win-over-daniil-medvedev/', 'content': '"nOur Latest Tennis StoriesnSinner makes epic comeback to win Australian OpennSinner, Sabalenka win Australian Open singles titlesn2024 Australian Open odds, Sinner vs. Medvedev picksnSabalenka defeats Zheng to win 2024 Australian Openn2024 Australian Open odds, Sabalenka vs. Zheng picksn2024 Australian Open odds, Medvedev vs. Zverev picksnAustralian Open odds: Djokovic vs. Sinner picks, betsnAustralian Open odds: Gauff vs. Sabalenka picks, betsnAustralian Open odds: Zheng vs. Yastremska picks, betsnNick Kyrgios reveals he's contemplating retirementn© 2004-2024 CBS Interactive. Jannik Sinner claims first Grand Slam title in epic comeback win over Daniil MedvedevnSinner, 22, rallied back from a two-set deficit to become the third ever Italian Grand Slam men's singles championnAfter almost four hours, Jannik Sinner climbed back from a two-set deficit to win his first ever Grand Slam title with an epic 3-6, 3-6, 6-4, 6-4, 6-3 comeback victory against Daniil Medvedev. Sinner became the first Italian man to win the Australian Open since 1976, and just the eighth man to successfully come back from two sets down in a major final.n He did not drop a single set until his meeting with Djokovic, and that win in itself was an accomplishment as Djokovic was riding a 33-match winning streak at the Australian Open and had never lost a semifinal in Melbourne.n @janniksin • @wwos • @espn • @eurosport • @wowowtennis pic.twitter.com/DTCIqWoUoRn"We are trying to get better everyday, and even during the tournament, trying to get stronger and understand the situation a little bit better," Sinner said.'}, {'url': 'https://www.bbc.com/sport/tennis/68120937', 'content': 'Live scores, results and order of playnAlerts: Get tennis news sent to your phonenRelated TopicsnTop StoriesnFA Cup: Blackburn Rovers v Wrexham - live text commentarynRussian skater Valieva given four-year ban for dopingnLinks to Barcelona are 'totally untrue' - ArtetanElsewhere on the BBCnThe truth behind the fake grooming scandalnFeaturing unseen police footage and interviews with the officers at the heart of the casenDid their father and uncle kill Nazi war criminals?n A real-life murder mystery following three brothers in their quest for the truthnWhat was it like to travel on the fastest plane?nTake a behind-the-scenes look at the supersonic story of the ConcordenToxic love, ruthless ambition and shocking betrayalnTell Me Lies follows a passionate college relationship with unimaginable consequences...n "nMarathon man Medvedev runs out of steamnMedvedev is the first player to lose two Grand Slam finals after winning the opening two setsnSo many players with the experience of a Grand Slam final have talked about how different the occasion can be, particularly if it is the first time, and potentially overwhelming.n Jannik Sinner beats Daniil Medvedev in Melbourne finalnJannik Sinner is the youngest player to win the Australian Open men's title since Novak Djokovic in 2008nJannik Sinner landed the Grand Slam title he has long promised with an extraordinary fightback to beat Daniil Medvedev in the Australian Open final.n "nSinner starts 2024 in inspired formnSinner won the first Australian Open men's final since 2005 which did not feature Roger Federer, Rafael Nadal or Novak DjokovicnSinner was brought to the forefront of conversation when discussing Grand Slam champions in 2024 following a stunning end to last season.n'}]
[Execute Result] {'thought': "The search results have provided consistent information about the winner of the 2024 Australian Open. Jannik Sinner is mentioned as the winner in multiple sources, which confirms the answer to the user's question.", 'action_name': 'finish', 'action_parameters': {'content': 'Jannik Sinner won the 2024 Australian Open.'}}
[Execute] Execute End.
[Revised Plan] {"goals": ["Find the hometown of the 2024 Australian Open winner"], "tasks": [{"task_id": 2, "description": "Research Jannik Sinner to find his place of birth or hometown."}, {"task_id": 3, "description": "Record the hometown of Jannik Sinner, the 2024 Australian Open winner."}], "next_task_id": 2}
[Agent] Tool Agent start...
[User instruction] Research Jannik Sinner to find his place of birth or hometown.
[Thought] To find Jannik Sinner's place of birth or hometown, I should use the search tool to find the most recent and accurate information.
[Action] tavily_search_results_json args: {'query': 'Jannik Sinner place of birth hometown'}
[Observation] [{'url': 'https://www.sportskeeda.com/tennis/jannik-sinner-nationality', 'content': "During the semifinal of the Cup, Sinner faced Djokovic for the third time in a row and became the first player to defeat him in a singles match. Jannik Sinner NationalitynJannik Sinner is an Italian national and was born in Innichen, a town located in the mainly German-speaking area of South Tyrol in northern Italy. A. Jannik Sinner won his maiden Masters 1000 title at the 2023 Canadian Open defeating Alex de Minaur in the straight sets of the final.n Apart from his glorious triumph at Melbourne Park in 2024, Jannik Sinner's best Grand Slam performance came at the 2023 Wimbledon, where he reached the semifinals. In 2020, Sinner became the youngest player since Novak Djokovic in 2006 to reach the quarter-finals of the French Open."}, {'url': 'https://en.wikipedia.org/wiki/Jannik_Sinner', 'content': "At the 2023 Australian Open, Sinner lost in the 4th round to eventual runner-up Stefanos Tsitsipas in 5 sets.[87]nSinner then won his seventh title at the Open Sud de France in Montpellier, becoming the first player to win a tour-level title in the season without having dropped a single set and the first since countryman Lorenzo Musetti won the title in Naples in October 2022.[88]nAt the ABN AMRO Open he defeated top seed and world No. 3 Stefanos Tsitsipas taking his revenge for the Australian Open loss, for his biggest win ever.[89] At the Cincinnati Masters, he lost in the third round to Félix Auger-Aliassime after being up a set, a break, and 2 match points.[76]nSeeded 11th at the US Open, he reached the fourth round after defeating Brandon Nakashima in four sets.[77] Next, he defeated Ilya Ivashka in a five set match lasting close to four hours to reach the quarterfinals for the first time at this Major.[78] At five hours and 26 minutes, it was the longest match of Sinner's career up until this point and the fifth-longest in the tournament history[100] as well as the second longest of the season after Andy Murray against Thanasi Kokkinakis at the Australian Open.[101]nHe reached back to back quarterfinals in Wimbledon after defeating Juan Manuel Cerundolo, Diego Schwartzman, Quentin Halys and Daniel Elahi Galan.[102] He then reached his first Major semifinal after defeating Roman Safiullin, before losing to Novak Djokovic in straight sets.[103] In the following round in the semifinals, he lost in straight sets to career rival and top seed Carlos Alcaraz who returned to world No. 1 following the tournament.[92] In Miami, he reached the quarterfinals of this tournament for a third straight year after defeating Grigor Dimitrov and Andrey Rublev, thus returning to the top 10 in the rankings at world No. In the final, he came from a two-set deficit to beat Daniil Medvedev to become the first Italian player, male or female, to win the Australian Open singles title, and the third man to win a Major (the second of which is in the Open Era), the first in 48 years.[8][122]"}, {'url': 'https://www.thesportreview.com/biography/jannik-sinner/', 'content': '• Date of birth: 16 August 2001n• Age: 22 years oldn• Place of birth: San Candido, Italyn• Nationality: Italiann• Height: 188cm / 6ft 2insn• Weight: 76kg / 167lbsn• Plays: Right-handedn• Turned Pro: 2018n• Career Prize Money: US$ 4,896,338n• Instagram: @janniksinnThe impressive 22-year-old turned professional back in 2018 and soon made an impact on the tour, breaking into the top 100 in the world rankings for the first time in 2019.n Jannik Sinner (Photo: Dubai Duty Free Tennis Championships)nSinner ended the season as number 78 in the world, becoming the youngest player since Rafael Nadal in 2003 to end the year in the top 80.n The Italian then ended the 2019 season in style, qualifying for the 2019 Next Gen ATP Finals and going on to win the tournament with a win over Alex de Minaur in the final.n Sinner then reached the main draw of a grand slam for the first time at the 2019 US Open, when he came through qualifying to reach the first round, where he lost to Stan Wawrinka.n Asked to acknowledge some of the key figures in his development, Sinner replied: “I think first of all, my family who always helped me and gave me the confidence to actually change my life when I was 13-and-a-half, 14 years old.n'}]
[Execute Result] {'thought': 'The search results have provided two different places of birth for Jannik Sinner: Innichen and San Candido. These are actually the same place, as San Candido is the Italian name and Innichen is the German name for the town. Since the user asked for the place of birth or hometown, I can now provide this information.', 'action_name': 'finish', 'action_parameters': {'content': 'Jannik Sinner was born in San Candido (Italian) / Innichen (German), Italy.'}}
[Execute] Execute End.
[Revised Plan] {"goals": ["Find the hometown of the 2024 Australian Open winner"], "tasks": [], "next_task_id": null}
[Agent Result] Jannik Sinner was born in San Candido (Italian) / Innichen (German), Italy.
[Agent] Agent End.
에이전트 개발 시나리오에서, 우리는 종종 더 나은 사용자 정의를 달성하기 위해 에이전트의 많은 원자 구성 요소를 분할해야합니다. PNE는 플래너와 같은 원자 화제 성분을 제공합니다. 다음 예는 작업 계획에 별도의 플래너 구성 요소를 사용하는 것을 보여줍니다.
import promptulate as pne
model = pne . LLMFactory . build ( "gpt-4-turbo" )
planner = pne . Planner ( model , system_prompt = "You are a planner" )
plans = planner . run ( "Plan a trip to Paris" )
print ( plans )산출:
('goals', ['Plan a trip to Paris'])
('tasks', [Task(task_id=1, description='Check passport validity', status=<TaskStatus.TODO: 'todo'>), Task(task_id=2, description='Determine travel dates', status=<TaskStatus.TODO: 'todo'>), Task(task_id=3, description='Research and book flights', status=<TaskStatus.TODO: 'todo'>), Task(task_id=4, description='Book accommodations', status=<TaskStatus.TODO: 'todo'>), Task(task_id=5, description='Plan itinerary for the trip', status=<TaskStatus.TODO: 'todo'>), Task(task_id=6, description='Investigate and purchase travel insurance', status=<TaskStatus.TODO: 'todo'>), Task(task_id=7, description='Set a budget for the trip', status=<TaskStatus.TODO: 'todo'>), Task(task_id=8, description='Pack luggage', status=<TaskStatus.TODO: 'todo'>), Task(task_id=9, description='Notify bank of international travel', status=<TaskStatus.TODO: 'todo'>), Task(task_id=10, description='Check weather forecast and pack accordingly', status=<TaskStatus.TODO: 'todo'>)])
('next_task_id', 1)
자세한 정보는 시작/공식 문서를 확인하십시오.
PNE 프레임 워크의 설계 원칙에는 모듈성, 확장 성, 상호 운용성, 견고성, 유지 관리, 보안, 효율성 및 유용성이 포함됩니다.
이러한 원칙에 따라 최신 인공 지능 기술을 적용한 pne 자동화 된 에이전트를 만들기위한 강력하고 유연한 프레임 워크를 제공하는 것을 목표로합니다.
자세한 내용은 [email protected]으로 문의하십시오
Changelog, Telegram 채널을 설명하십시오
오픈 소스 이니셔티브에 기여하는 데 관심이 있습니다. 우리는 프롬프트에 기여하기위한 단계를 요약하는 개발자 안내서를 제공했습니다. 원활한 협업 및 성공적인 기부금을 보려면이 안내서를 참조하십시오. 또한 현재 개발 계획을보고 최신 개발 진행 상황을 볼 수 있습니까?