Exploring Queries

The Explore page in Infactory allows you to test your deployed queries, understand how they respond to different questions, and refine your query selection algorithm. This guide explains how to use the Explore page to get the most out of your deployed queries.

Understanding the Explore Page

The Explore page provides an interactive interface to test how Infactory handles natural language questions against your deployed queries:

  • Question Input: Where you can type natural language questions
  • Answer Panel: Displays the structured data results and which query was used
  • History Panel: Shows a history of your tested questions
  • Query Selection Information: Explains why a particular query was selected

Testing with Natural Language Questions

The primary purpose of the Explore page is to test how the unified API endpoint handles natural language questions:

1

Navigate to the Explore page

Click on the Explore tab in your Infactory project.

2

Enter a natural language question

Type a question related to your data in the question input field (e.g., “What is the average height of quarterbacks?”).

3

Submit the question

Press Enter or click the submit button to send your question.

4

View the results

The Answer Panel will show:

  • Which query was selected to answer the question
  • The parameters that were extracted from your question
  • The structured data results

Interpreting the Results

When you submit a question, Infactory:

  1. Analyzes the question to understand what you’re asking
  2. Selects the most appropriate deployed query to answer the question
  3. Extracts parameters (slot values) from your question
  4. Executes the query with those parameters
  5. Returns the structured data results

The Explore page shows you all of this information, helping you understand how Infactory interprets questions.

Query Selection Algorithm

Infactory uses a sophisticated algorithm to select the best query for each question:

  1. Semantic Matching: Compares the question to the patterns each query is designed to answer
  2. Parameter Extraction: Identifies specific values in the question that map to query parameters
  3. Confidence Scoring: Calculates a confidence score for each query based on the match
  4. Selection: Chooses the query with the highest confidence score above a threshold

The Explore page shows you the confidence scores and why a particular query was selected.

Handling Unanswerable Questions

If a question can’t be answered by any of your deployed queries, Infactory will indicate this clearly:

  1. You’ll see a message indicating no matching query was found
  2. You may receive suggestions for similar questions that can be answered
  3. You can use this feedback to identify gaps in your query coverage

This helps you identify what types of questions you might want to create new queries for.

Query Coverage Analysis

The Explore page can help you analyze the coverage of your deployed queries:

Identifying Coverage Gaps

Try asking various questions related to your data to identify what types of questions your current queries can’t answer. Look for patterns in the unanswerable questions to guide what new queries to create.

Evaluating Query Generalization

Test variations of questions to see how well your general-purpose queries handle different phrasings and parameters. For example, if you have a query for “average by category”, try:

  • “What’s the average height by position?”
  • “Show me the mean weight for each team.”
  • “Average age by state?”

Resolving Query Conflicts

Sometimes multiple queries might seem appropriate for a given question. Use the Explore page to identify these conflicts and refine your queries to have clearer boundaries.

Best Practices for Exploration

To get the most out of the Explore page:

  • Test Edge Cases: Try unusual but valid questions to see how the system responds
  • Vary Phrasings: Ask the same question in different ways to test robustness
  • Test Parameter Variations: Try different parameter values to ensure proper extraction
  • Compare Similar Questions: Ask slightly different questions to understand selection boundaries
  • Document Findings: Keep track of what works well and what doesn’t for future reference

Fine-Tuning Query Selection

If you find that Infactory isn’t selecting the query you expect for certain questions, you can fine-tune the selection algorithm:

Improving Query Descriptions

Each query has a description that helps Infactory understand what types of questions it can answer. Update these descriptions to be more specific and accurate:

  1. Go to the Build tab
  2. Select the query you want to improve
  3. Update the description field with more precise information
  4. Deploy the updated query

Adding Example Questions

You can add example questions to help Infactory better understand what each query should be used for:

  1. Go to the Build tab
  2. Select the query you want to improve
  3. In the “Example Questions” section, add examples of questions this query should answer
  4. Deploy the updated query

Using Exploration Insights to Improve Queries

The insights you gain from the Explore page can be used to improve your queries:

Creating New Queries

If you find common questions that can’t be answered, create new queries to fill these gaps:

  1. Go to the Build tab
  2. Click New Query
  3. Use the question pattern you identified as inspiration
  4. Create and deploy the new query
  5. Return to the Explore page to verify it works as expected

Refining Existing Queries

If a query is being selected correctly but doesn’t provide the expected results, refine it:

  1. Go to the Build tab
  2. Select the query to refine
  3. Modify the query to better handle the question pattern
  4. Deploy the updated query
  5. Test again in the Explore page

Integration with Applications

The exploration process is critical for developing robust applications that use Infactory:

Testing Your Integration

Use the Explore page to test and refine the same questions your application will ask before implementing them in code. This helps ensure your application will get the expected responses.

Developing UX Flows

Based on the query selection and responses you observe, design your application’s UX to guide users toward questions that can be answered effectively.

Handling Edge Cases

Identify how your application should handle cases where:

  • No query can answer the question
  • Multiple queries could potentially answer the question
  • Parameters can’t be extracted properly

Next Steps

Now that you understand how to explore and test your deployed queries, you’re ready to integrate Infactory with your applications. Check out our API Reference for comprehensive documentation on the Infactory API.

Was this page helpful?