Closed hyjin-asc closed 5 months ago
For a few days now, I've been getting an error when downloading chat-style prompts (promptlayer version is 0.4.3 latest).
import promptlayer prompt = promptlayer.prompts.get( 'chat-test', langchain=True, )
Unknown error occurred. 1 validation error for ChatPromptTemplate __root__ Got mismatched input_variables. Expected: set(). Got: ['text'] (type=value_error)
I've checked where the error is coming from and it's in the code below. There is no _type inside the prompt for each message. https://github.com/MagnivOrg/prompt-layer-library/blob/6dfb19affcf330620d26cff982a8e88ac369b428/promptlayer/prompts/chat.py#L31
>>> print(prompt_dict) {'_type': 'chat_promptlayer_langchain', 'function_call': 'none', 'input_variables': ['text'], 'messages': [{'prompt': {'input_variables': [], 'template': 'You are a helpful assistant.', 'template_format': 'f-string'}, 'role': 'system'}, {'prompt': {'input_variables': ['text'], 'template': 'this is prompt\n\n{text}', 'template_format': 'f-string'}, 'role': 'user'}]} >>> print(prompt_dict['messages'][0]) {'prompt': {'input_variables': [], 'template': 'You are a helpful assistant.', 'template_format': 'f-string'}, 'role': 'system'} >>>print(prompt_dict['messages'][1]) {'prompt': {'input_variables': ['text'], 'template': 'this is prompt\n\n{text}', 'template_format': 'f-string'}, 'role': 'user'}
So I think I need to change that line to the one below.
# before if not prompt or "_type" not in prompt: continue # after if not prompt: continue
For a few days now, I've been getting an error when downloading chat-style prompts (promptlayer version is 0.4.3 latest).![image](https://github.com/MagnivOrg/prompt-layer-library/assets/87632052/82397bbb-3353-4dff-a90e-40e08f5f37f2)
I've checked where the error is coming from and it's in the code below. There is no _type inside the prompt for each message. https://github.com/MagnivOrg/prompt-layer-library/blob/6dfb19affcf330620d26cff982a8e88ac369b428/promptlayer/prompts/chat.py#L31
So I think I need to change that line to the one below.