sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.59k stars 275 forks source link

Rewrite queries based on chat history and mentioned context items for better enhanced context fetching #4623

Closed thenamankumar closed 3 months ago

thenamankumar commented 3 months ago

closes: https://linear.app/sourcegraph/issue/CODY-2272/rewrite-query-including-content-of-mention-before-sending-to-context

This PR adds an experimental feature under the experimentalNoodle flag to rewrite the queries based on the chat history (last 3 interactions) and the mentioned context items before sending it for enhanced context fetching; assuming it would improve the performance of the context search.

This is similar to the keyword expansion integrated with symf search right now, but it performs the rewrite based on the chat history as well as the mentioned context items, unlike the keyword expansion which treats the query in isolation.

The formal evaluation of this technique has not been done yet but it is the next step.

Until we have evaluated that the rewrite boosts the performance of the context retrieval, we will keep the rewrite step behind the experimental flag.

Test plan

A few examples are (the rewritten query manually pasted in the input box while debugging):

image

image

github-actions[bot] commented 3 months ago

‼️ Hey @sourcegraph/cody-security, please review this PR carefully as it introduces the usage of an unsafe_ function or abuses PromptString.