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

Use neural search with AI Chat searching #326

Merged
merged 1 commit into from
May 7, 2024

Conversation

adamjarling
Copy link
Contributor

@adamjarling adamjarling commented May 7, 2024

What does this do?

Updates the OpenSearch query object to use a hybrid search (using neural), when a user is searching via AI Chat.

How to test?

Note it's a little tough to test UI search results against limited staging data

  • Update your local miscellany repo for env variables needed for hybrid search
  • Perform a regular and Chat AI search.
  • Inspect the request body, and notice when using AI Chat search (if a search term is provided), the request payload should resemble something like:
  • The Search results should visually appear as expected, but the paginated results will be calculated differently by the API
{
   ...
    "query": {
        "hybrid": {
            "queries": [
                {
                    "bool": {
                        "must": [
                            {
                                "query_string": {
                                    "fields": [
                                        "title^5",
                                        "all_text",
                                        "all_controlled_labels",
                                        "all_ids"
                                    ],
                                    "query": "Do we have music by Mozart?"
                                }
                            }
                        ]
                    }
                },
                {
                    "neural": {
                        "embedding": {
                            "k": 40,
                            "model_id": NEXT_PUBLIC_OPENSEARCH_MODEL_ID,
                            "query_text": "Do we have music by Mozart?"
                        }
                    }
                }
            ]
        }
    },
    "size": 40
}

@adamjarling adamjarling self-assigned this May 7, 2024
Copy link
Contributor

@bmquinn bmquinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query looks great in my dev env. It's really awesome seeing the hybrid query results coming in while the streaming response is being generated! 😄

@adamjarling adamjarling merged commit 0ecee43 into preview/chat-integration May 7, 2024
1 check passed
@adamjarling adamjarling deleted the 4609-neural-search branch May 7, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants