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

[bug fix] improved json mode in global search #545

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jaigouk
Copy link

@jaigouk jaigouk commented Jul 14, 2024

Description

This pull request adds comprehensive unit tests for the GlobalSearch class, enhancing the overall test coverage and reliability of the structured search functionality.

json mode needs "JSON" text in the system prompt

Screenshot 2024-07-15 at 11 02 25

So I added

if self.json_mode:
                search_prompt += "\nYour response should be in JSON format."

Related Issues

#471

Proposed Changes

  • Implement mock classes for LLM and ContextBuilder to isolate tests
  • Add tests for parse_search_response method covering various scenarios:
    • Valid JSON responses
    • Invalid JSON input
    • Missing 'points' key
    • Invalid point format
    • Responses with text prefix
    • Non-integer scores
  • Include tests for internal methods _map_response_single_batch and _reduce_response
  • Add test for the main asearch method
  • Ensure proper handling of asynchronous methods in tests

Checklist

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation (if necessary).
  • I have added appropriate unit tests.

Additional Notes

Added more tests for search.py

@jaigouk jaigouk requested a review from a team as a code owner July 14, 2024 01:50
@jaigouk
Copy link
Author

jaigouk commented Jul 14, 2024

@microsoft-github-policy-service agree

@jaigouk jaigouk mentioned this pull request Jul 14, 2024
@jaigouk jaigouk closed this Jul 14, 2024
@jaigouk jaigouk reopened this Jul 14, 2024
@jaigouk jaigouk force-pushed the enhance-json-parsing branch 6 times, most recently from 1e42f57 to bfe8d34 Compare July 16, 2024 19:52
- added system prompt to answer in JSON format
@jaigouk jaigouk changed the title [bug fix] improved parsing json in global search [bug fix] improved json mode in global search Jul 16, 2024
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.

1 participant