microsoft / promptflow

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring.
https://microsoft.github.io/promptflow/
MIT License
9.51k stars 869 forks source link

[BUG] [VSCode Extension] 'vector.fields' parameter. #2026

Closed Kevinlee49 closed 8 months ago

Kevinlee49 commented 9 months ago

I want to send the output of LLM that represents the input query to the hybrid search and semantic search(these two nodes are index lookup tools) at the same time. But the error 'vector.fields' occurred. Do you know how to solve this problem?

2024-02-16_17-57-17

I also aim to unify the results of both searches into one output. The screenshot below shows the basic structure of my workflow.

2024-02-16_18-07-42
D-W- commented 9 months ago

Hi @dans-msft @Adarsh-Ramanathan , could you help to take a look of this issue?

Adarsh-Ramanathan commented 9 months ago

@Kevinlee49, can you share your flow yaml (or, ideally, a yaml that is a minimal repro of this issue)?

Kevinlee49 commented 9 months ago

@Adarsh-Ramanathan

environment:
  python_requirements_txt: requirements.txt
inputs:
  question:
    type: string
    is_chat_input: false
outputs:
  output:
    type: string
    reference: ${answer_the_question_with_context.output}
    evaluation_only: false
    is_chat_output: true
nodes:
- name: rephrase_and_classify_input
  use_variants: true
- name: answer_the_question_with_context
  type: llm
  source:
    type: code
    path: answer_the_question_with_context.jinja2
  inputs:
    deployment_name: gpt-35-turbo-16k-v0613
    temperature: 0
    top_p: 1
    max_tokens: 1000
    response_format:
      type: text
    presence_penalty: 0
    frequency_penalty: 0
    final_prompt: ${final_prompt.output}
  provider: AzureOpenAI
  connection: test-connection
  api: chat
  module: promptflow.tools.aoai
  aggregation: false
  use_variants: false
- name: input_classify_and_rephrase
  type: prompt
  source:
    type: code
    path: input_classify_and_rephrase.jinja2
  inputs:
    question: ${inputs.question}
  use_variants: false
- name: semantic_search
  type: python
  source:
    type: package
    tool: promptflow_vectordb.tool.common_index_lookup.search
  inputs:
    mlindex_content: >
      embeddings:
        api_base: https://
        api_type: azure
        api_version: 2023-07-01-preview
        batch_size: '16'
        connection:
          id: /subscriptions/
        connection_type: workspace_connection
        deployment: text-embedding-ada-002
        dimension: 1536
        file_format_version: '2'
        kind: open_ai
        model: text-embedding-ada-002
        schema_version: '2'
      index:
        api_version: 2023-07-01-preview
        connection:
          id: /subscriptions/
        connection_type: workspace_connection
        endpoint: https://
        engine: azure-sdk
        field_mapping:
          content: content
          embedding: contentVector
          filename: filepath
          metadata: meta_json_string
          title: title
          url: url
        index: pf-rpindex
        kind: acs
        semantic_configuration_name: azureml-default
    queries: ${rephrase_and_classify_input.output}
    query_type: Semantic
    top_k: 3
  use_variants: false
- name: hybrid_search
  type: python
  source:
    type: package
    tool: promptflow_vectordb.tool.common_index_lookup.search
  inputs:
    mlindex_content: >
      embeddings:
        api_base: https://
        api_type: azure
        api_version: 2023-07-01-preview
        batch_size: '16'
        connection:
          id: /subscriptions/
        connection_type: workspace_connection
        deployment: text-embedding-ada-002
        dimension: 1536
        file_format_version: '2'
        kind: open_ai
        model: text-embedding-ada-002
        schema_version: '2'
      index:
        api_version: 2023-07-01-preview
        connection:
          id: /subscriptions/
        connection_type: workspace_connection
        endpoint: https://
        engine: azure-sdk
        field_mapping:
          content: content
          embedding: contentVector
          filename: filepath
          metadata: meta_json_string
          title: title
          url: url
        index: pf-rpindex
        kind: acs
        semantic_configuration_name: azureml-default
    queries: ${rephrase_and_classify_input.output}
    query_type: Hybrid (vector + keyword)
    top_k: 3
  use_variants: false
- name: generate_context
  type: python
  source:
    type: code
    path: generate_context.py
  inputs:
    hybrid_search_output: ${hybrid_search.output}
    semantic_search_output: ${semantic_search.output}
  use_variants: false
- name: final_prompt
  type: prompt
  source:
    type: code
    path: final_prompt.jinja2
  inputs:
    context: ${generate_context.output}
    question: ${rephrase_and_classify_input.output}
  use_variants: false
node_variants:
  rephrase_and_classify_input:
    default_variant_id: variant_0
    variants:
      variant_0:
        node:
          type: llm
          source:
            type: code
            path: input_classify_and_rephrase.jinja2
          inputs:
            deployment_name: gpt-35-turbo-16k-v0613
            temperature: 0.9
            top_p: 1
            max_tokens: 4096
            response_format:
              type: text
            presence_penalty: 0
            frequency_penalty: 0
            question: ${input_classify_and_rephrase.output}
          provider: AzureOpenAI
          connection: test-connection
          api: chat
          module: promptflow.tools.aoai
      variant_1:
        node:
          type: llm
          source:
            type: code
            path: rephrase_and_classify_input__variant_1.jinja2
          inputs:
            deployment_name: gpt-35-turbo-16k-v0613
            temperature: 0.9
            top_p: 1
            max_tokens: 4096
            response_format:
              type: text
            presence_penalty: 0
            frequency_penalty: 0
            question: ${python_query_analyze_and_rephrase.output}
          provider: AzureOpenAI
          connection: test-connection
          api: chat
          module: promptflow.tools.aoai
Kevinlee49 commented 8 months ago

@Adarsh-Ramanathan Hello, did you solve this issue? I'm still waiting your feedback..!

ChenJieting commented 8 months ago

Have synced with the user. Since this issue has been included in this one: #2046, we will close it and link it to issue #2046.