在迅速的工程領域,管理多個提示的管理可能會變得壓倒性。個人和團隊經常在跟踪和組織不同類型的提示方面面臨挑戰,從而導致可能錯過一些最好的提示。
實驗性開源試圖使迅速工程師和開發人員的生活變得容易。無組織的管理提示方式使工作變得艱難,因此我們帶來了一種結構化的方法,以幫助工程師和開發人員輕鬆與團隊輕鬆跟踪,共享和處理提示。及時的組織者。
基於任務的組織:用戶可以在不同的任務(摘要,主題發現,意圖身份等)下組織提示,從而可以清楚地分類每個提示。
提示版本管理:在每個任務中,用戶可以創建和管理多個提示版本,每個版本都具有其唯一的參數集。
差異可視化:用戶可以利用集成的“顯示diff”功能來毫不費力地可視化和比較各種提示版本之間的差異,添加或刪除,並突出顯示以容易發現。
提示參數配置:用戶可以輕鬆地配置各種參數,例如溫度,top_p,max令牌以及提示的每個版本的閾值。
狀態跟踪:該應用程序允許用戶設置和跟踪每個提示的狀態,從而幫助及時評估和優化。
評論功能:每個提示版本都有一個關聯的評論框,允許用戶註釋與提示有關的重要說明或信息。
系統提示管理:與用戶提示一起,該應用程序還可以啟用系統提示的管理,每個提示都帶有其評論功能。
保存和下載:用戶可以節省其進度並以YAML格式下載有組織的提示,從而易於共享和存儲。
開發人員管道的YAML集成:該應用程序通過將YAML文件直接合併到其開發管道中,從而無縫地促進了開發人員,從而使開發過程更加直觀且易於錯誤。
單用戶應用程序:此應用程序目前是為個人使用而設計的,併計劃將來升級以支持多個用戶。
轉到“提示組織者”文件夾並運行:
python app.py
我使用了python 3.8
從提示組織者下載YAML文件,並使用此方法加載它:
import yaml
def read_template():
directory_path = "data.yaml"
yaml_content = ''
with open(directory_path, "r") as f:
try:
yaml_content = yaml.safe_load(f)
except yaml.YAMLError as e:
print(f"Error parsing {directory_path}: {e}")
return yaml_content
def get_prompt(task, version):
yaml_content = read_template()
version = "version"+"_"+str(version)
return yaml_content[task]['prompts']['version_1']["prompt"]
prompt = get_prompt("Intent",1)
def get_parameters(task, version):
yaml_content = read_template()
version = "version"+"_"+str(version)
temp = yaml_content[task]['prompts'][version]['temperature']
top_p = yaml_content[task]['prompts'][version]['top_p']
max_tokens = yaml_content[task]['prompts'][version]['max_tokens']
threshold = yaml_content[task]['prompts'][version]['threshold']
return {"temperature":temp, "top_p":top_p, "max_tokens":max_tokens, "threshold":threshold}
params = get_parameters('Intent',1)
在提示內使用佔位符,並用正確的內容代替:
示例提示:
我給您段落,您必須找到具有很高討論價值的最重要意圖。所有意圖必須以字符串格式,相關得分必須為浮點格式。 n n n n n n n ndo不加添加,以下是字典格式的輸出。任何解釋。
用輸入段式動態替換##佔位符_1 ## 。
passage_content = "Your passage data"
prompt_passage = get_prompt('Intent',1)
prompt_passage = prompt_passage.replace("##placeholder_1##", passage_content)
使用helper.py文件使用所有這些方法。
openai.api_key = 'your-api-key-here'
passage_content = "Your data"
prompt_passage = get_prompt("Intent", 1) # This will provide you the prompt for the specified version and task.
system_prompt = get_sysprompt("Intent", 1) # This will provide you the system prompt for the specified version and task.
prompt_param = get_parameters("Intent", 1) # This will provide you the all parameters for the specified version and task.
prompt_passage = prompt_passage.replace("##placeholder_1##", passage_content)
response = openai.ChatCompletion.create(
model = "gpt-3.5-turbo",
temperature = prompt_param["temperature"],
top_p = prompt_param["top_p"],
max_tokens = prompt_param["max_tokens"],
messages=[
{"role": "system", "content": prompt_passage},
{"role": "user", "content": system_prompt},
]
)
# Extracting response
answer = response['choices'][0]['message']['content']
print(answer)
通過遵守概述的步驟,您可以採用一種結構化和系統的方法。促使組織者能夠通過保證來設計,精心檢查和實施您的提示。這導致了高級和可靠的AI應用程序的開發。
目前,我從項目中運行此應用程序,以避免使用YAML文件來回移動。我所有的修改都保持在項目級別。在不久的將來,這個想法是使這種集成無縫的。
還有更多...
所有這些都易於使用。
快樂提示,拍手:提示組織者?