- 
                Notifications
    
You must be signed in to change notification settings  - Fork 304
 
[QnA Maker] Multi-turn support for python #305
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            8 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1a80011
              
                [QnA Maker] Multi-turn support for python
              
              
                gurvsing aafa25d
              
                [QnA Maker] Multi-turn  support for python
              
              
                gurvsing 4b67e2d
              
                Comment addressed
              
              
                gurvsing 48ecbf5
              
                File formatted
              
              
                gurvsing 5ed1c1b
              
                Merge branch 'master' into gurvsing/multiturn
              
              
                axelsrz a545193
              
                Comment fix
              
              
                gurvsing 5452ba7
              
                Merge branch 'master' into gurvsing/multiturn
              
              
                gurvsing a8e2da0
              
                Merge branch 'gurvsing/multiturn' of https://github.com/microsoft/bot…
              
              
                gurvsing File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            45 changes: 45 additions & 0 deletions
          
          45 
        
  libraries/botbuilder-ai/botbuilder/ai/qna/models/prompt.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
| 
     | 
||
| from msrest.serialization import Model | ||
| 
     | 
||
| 
     | 
||
| class Prompt(Model): | ||
| """ Prompt Object. """ | ||
| 
     | 
||
| _attribute_map = { | ||
| "display_order": {"key": "displayOrder", "type": "int"}, | ||
| "qna_id": {"key": "qnaId", "type": "int"}, | ||
| "qna": {"key": "qna", "type": "object"}, | ||
| "display_text": {"key": "displayText", "type": "str"}, | ||
| } | ||
| 
     | 
||
| def __init__( | ||
| self, | ||
| *, | ||
| display_order: int, | ||
| qna_id: int, | ||
| display_text: str, | ||
| qna: object = None, | ||
| **kwargs | ||
| ): | ||
| """ | ||
| Parameters: | ||
| ----------- | ||
| 
     | 
||
| display_order: Index of the prompt - used in ordering of the prompts. | ||
| 
     | 
||
| qna_id: QnA ID. | ||
| 
     | 
||
| display_text: Text displayed to represent a follow up question prompt. | ||
| 
     | 
||
| qna: The QnA object returned from the API (Optional). | ||
| 
     | 
||
| """ | ||
| 
     | 
||
| super(Prompt, self).__init__(**kwargs) | ||
| 
     | 
||
| self.display_order = display_order | ||
| self.qna_id = qna_id | ||
| self.display_text = display_text | ||
| self.qna = qna | 
        
          
          
            31 changes: 31 additions & 0 deletions
          
          31 
        
  libraries/botbuilder-ai/botbuilder/ai/qna/models/qna_request_context.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
| 
     | 
||
| from msrest.serialization import Model | ||
| 
     | 
||
| 
     | 
||
| class QnARequestContext(Model): | ||
                
      
                  gurvsing marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| """ | ||
| The context associated with QnA. | ||
| Used to mark if the current prompt is relevant with a previous question or not. | ||
| """ | ||
| 
     | 
||
| _attribute_map = { | ||
| "previous_qna_id": {"key": "previousQnAId", "type": "int"}, | ||
| "prvious_user_query": {"key": "previousUserQuery", "type": "string"}, | ||
| } | ||
| 
     | 
||
| def __init__(self, previous_qna_id: int, prvious_user_query: str, **kwargs): | ||
| """ | ||
| Parameters: | ||
| ----------- | ||
| previous_qna_id: The previous QnA Id that was returned. | ||
| prvious_user_query: The previous user query/question. | ||
| """ | ||
| 
     | 
||
| super().__init__(**kwargs) | ||
| 
     | 
||
| self.previous_qna_id = previous_qna_id | ||
| self.prvious_user_query = prvious_user_query | ||
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  libraries/botbuilder-ai/botbuilder/ai/qna/models/qna_response_context.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
| 
     | 
||
| from typing import List | ||
| from msrest.serialization import Model | ||
| from .prompt import Prompt | ||
| 
     | 
||
| 
     | 
||
| class QnAResponseContext(Model): | ||
| """ | ||
| The context associated with QnA. | ||
| Used to mark if the qna response has related prompts. | ||
| """ | ||
| 
     | 
||
| _attribute_map = { | ||
| "is_context_only": {"key": "isContextOnly", "type": "bool"}, | ||
| "prompts": {"key": "prompts", "type": "[Prompt]"}, | ||
| } | ||
| 
     | 
||
| def __init__( | ||
| self, *, is_context_only: bool = False, prompts: List[Prompt] = None, **kwargs | ||
| ): | ||
| """ | ||
| Parameters: | ||
| ----------- | ||
| 
     | 
||
| is_context_only: Whether this prompt is context only. | ||
| 
     | 
||
| prompts: The prompts collection of related prompts. | ||
| 
     | 
||
| """ | ||
| 
     | 
||
| super(QnAResponseContext, self).__init__(**kwargs) | ||
| self.is_context_only = is_context_only | ||
| self.prompts = prompts | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            18 changes: 18 additions & 0 deletions
          
          18 
        
  libraries/botbuilder-ai/tests/qna/test_data/AnswerWithHighScoreProvidedContext.json
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "answers": [ | ||
| { | ||
| "questions": [ | ||
| "Where can I buy cleaning products?" | ||
| ], | ||
| "answer": "Any DIY store", | ||
| "score": 100, | ||
| "id": 55, | ||
| "source": "Editorial", | ||
| "metadata": [], | ||
| "context": { | ||
| "isContextOnly": true, | ||
| "prompts": [] | ||
| } | ||
| } | ||
| ] | ||
| } | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.