-
Notifications
You must be signed in to change notification settings - Fork 1
Improve Performance: CoPilot: users experience #110
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
base: dev
Are you sure you want to change the base?
Conversation
…, pre-load prompts for classifier, contextualizer
…sification session
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
||
| // Process all complete SSE messages in buffer | ||
| let sepIndex; | ||
| while ((sepIndex = buffer.indexOf('\n\n')) !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this will cause infinite loop here when buffer.indexOf('\n\n') !== -1, please make sure that the loop can be breaked from the loop no matter which parts will be executed
| SUB_FEATURE = 'ltp' | ||
|
|
||
| SKIP_LUCIA_CONTROLLER_EXECUTION = True | ||
| class LTP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, why naming this as LTP? From the comments below, LtpQueryEngine is a better name than the project name. 😁
| proxy_send_timeout 2m; | ||
| } | ||
|
|
||
| location ~ ^/copilot/api/stream(.*)$ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to remove the original part above?
| """ | ||
| self.llm_session = llm_session | ||
| self.feature_skipped = True | ||
| self.ltp_documentation = get_prompt_from(os.path.join(PROMPT_DIR, self.SUB_FEATURE, 'ltp_documentation.txt')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the file and find that this function may through an exception. Is that the exception you want in init function?
| query, end_time_stamp, parallel, param = gen_promql_query(self.SUB_FEATURE, question, self.llm_session) | ||
|
|
||
| if not query: | ||
| logger.info(f'No query found in the response, query is {query}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion and you can keep the code. 😊 Is this a warning instead of info?
| help_msg['sku'] + | ||
| help_msg['workload']) | ||
| else: | ||
| self.capability_str = help_msg['feature'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a kind reminder, both verion f3 and f4 use this one?
| except Exception as e: | ||
| logger.error(f"Failed to parse JSON body for stream_operation: {e}") | ||
| return jsonify({"status": "error", "message": "invalid json"}), 400 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra empty line
| try: | ||
| llm_session.clear_instance_stream_callback() | ||
| except Exception: | ||
| logger.debug('Failed to clear instance stream callback') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if exception happens here?
| # verion f3, resolves objective 8 (Lucia Training Platform) | ||
| if self._version == 'f3': | ||
| if obj.count('8') > 0: | ||
| # debug only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove these code which are for debug only?
| help_keys = ['unsupported_question'] | ||
| answer = self.smart_help.generate(question, help_keys, True) | ||
| debug = {} | ||
| elif obj.count('8') > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see many magic numbers like 8, 3, 9 here, plase add some comments or use const variable with meaningful name to replace them so other developers can understand them well.
This PR is mainly about improving the user experience.
Effectiveness of this PR: