Unable to create variant in Prompt Flow VSCode
Discussed in https://github.com/microsoft/promptflow/discussions/2143
Originally posted by sargupta February 27, 2024
I have been trying to create a variant from the LLM tool, though I am able to do so in Azure ML PF UI however, when trying the same in VS Code, it's giving the following error:
basically, it's not recognizing the jinja2 file of the variant. Note: this is irrespective if I am using same connection or a different one
Any thoughts?
Hi @sargupta , I can't repro the issue. Can I know what extension version you used? If it was not the latest version. Can you try to update to the latest and then have a try? If you still encounter the same issue, can you please share the content of the flow.dag.yaml file and the content of the .promptflow/flow.tools.json file?
By the way, there is a known issue with python 3.12. If you use python 3.12, you may need to downgrade to 3.11.
Hi @naiyunzhang
- pf version: 1.5.0
- python version: 3.11.5 (previously tried 3.12.1)
Tried using python 3.11 however it didn't solve the issue. Here is the content of flow.dag.yaml file:
name: Template Chat Flow
environment:
python_requirements_txt: requirements.txt
inputs:
chat_history:
type: list
question:
type: string
is_chat_input: true
outputs:
answer:
type: string
reference: ${parent.output}
is_chat_output: true
nodes:
- name: parent
type: llm
source:
type: code
path: parent.jinja2
inputs:
deployment_name: gpt-35-turbo
max_tokens: 256
temperature: 0.7
chat_history: ${inputs.chat_history}
question: ${inputs.question}
provider: AzureOpenAI
connection: azure_open_ai_connection
api: chat
- name: parent_variant_gpt4
type: llm
source:
type: code
path: parent_variant_gpt4.jinja2
inputs:
deployment_name: gpt-4
max_tokens: 256
temperature: 0.7
chat_history: ${inputs.chat_history}
question: ${inputs.question}
provider: AzureOpenAI
connection: azure_open_ai_connection_gpt4
api: chat
However, there is no such file as .promptflow/flow.tools.json. List of files you can find in the above screenshot.
@sargupta I mean the prompt flow vscode extension version. You can find your extension version here:
The .promptflow/flow.tools.json file should be located in evaluation_dev/exp_eval_dev_flow_01/.promptflow/flow.tools.json.
And, have you updated your flow.dag.yaml file from the time this issue occurred? It seems that there is not a variant on the node parent named variant_1 in this flow.dag.yaml file.
Hi @naiyunzhang
Prompt flow for VS Code - v1.0.7 flow.dag.yaml
{
"package": {},
"code": {
"parent.jinja2": {
"type": "llm",
"inputs": {
"question": {
"type": [
"string"
]
},
"chat_history": {
"type": [
"string"
]
}
},
"source": "parent.jinja2"
}
}
}
flow.dag.yaml
id: template_chat_flow
name: Template Chat Flow
environment:
python_requirements_txt: requirements.txt
inputs:
chat_history:
type: list
question:
type: string
is_chat_input: true
default: I need n iphone 15
outputs:
answer:
type: string
reference: ${parent.output}
is_chat_output: true
nodes:
- name: parent
use_variants: true
node_variants:
parent:
default_variant_id: variant_0
variants:
variant_0:
node:
type: llm
source:
type: code
path: parent.jinja2
inputs:
deployment_name: gpt-35-turbo
max_tokens: 256
temperature: 0.7
chat_history: ${inputs.chat_history}
question: ${inputs.question}
provider: AzureOpenAI
connection: azure_open_ai_connection
api: chat
variant_1:
node:
type: llm
source:
type: code
path: parent_variant_1.jinja2
inputs:
deployment_name: gpt-35-turbo
max_tokens: 256
temperature: 0.7
chat_history: ${inputs.chat_history}
question: ${inputs.question}
connection: azure_open_ai_connection_gpt4
api: chat
@sargupta The version v1.0.7 is old. There was a bug in some old versions and it has been fixed in newer versions. I believe an update to the newest version will fix the issue you encountered. Please have a try. Much thanks.