Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create variant in Prompt Flow VSCode #2144

Closed
sargupta opened this issue Feb 27, 2024 Discussed in #2143 · 5 comments
Closed

Unable to create variant in Prompt Flow VSCode #2144

sargupta opened this issue Feb 27, 2024 Discussed in #2143 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@sargupta
Copy link

Discussed in #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:
image (1)
image (2)

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?

@JYC-99 JYC-99 added bug Something isn't working labels Feb 28, 2024
@naiyunzhang
Copy link
Contributor

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.

@naiyunzhang naiyunzhang assigned naiyunzhang and unassigned JYC-99 Feb 28, 2024
@sargupta
Copy link
Author

sargupta commented Feb 29, 2024

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.

@naiyunzhang
Copy link
Contributor

@sargupta I mean the prompt flow vscode extension version. You can find your extension version here:
image

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.

@sargupta
Copy link
Author

sargupta commented Mar 1, 2024

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

@naiyunzhang
Copy link
Contributor

@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.

@naiyunzhang naiyunzhang closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants