-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: multi-agent AI XBlock #9
base: main
Are you sure you want to change the base?
Conversation
e6fc51e
to
0a58220
Compare
0a58220
to
f6f0470
Compare
|
||
|
||
DEFAULT_SUPERVISOR_PROMPT = textwrap.dedent(""" | ||
You are a supervisor managing an interaction between the following agents: Coach, Character. |
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.
@ArturGaspar Was this prompt provided by WGU?
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.
@pkulkark Yes.
role: str | ||
|
||
|
||
class CharacterData(pydantic.BaseModel): |
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.
These pydantic models seem to be used for validation. Any reason for not using django serializers?
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.
@pkulkark Is there any reason to prefer them?
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.
@ArturGaspar Just for consistency with the rest of edx-platform xblocks. Since the xblock uses Django models, using a Django serializer would be more idiomatic.
ValidationMessage.ERROR, | ||
f"{self._get_field_display_name('agent_prompt')}: {e}", | ||
)) | ||
else: |
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.
Why do we need else
here? Couldn't we just continue without it?
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.
The part under the else checks that the template will render correctly for each character. The part above that it will render at all with the scenario data.
If the agent prompt has errors with the scenario data, it would be pointlessly noisy to repeat it for every character.
<textarea class="user-input" rows="1" placeholder="Type your answer here" maxlength="1000"></textarea> | ||
<span id="submit-button">Submit <i class="fa fa-paper-plane"></i></span> | ||
{% if has_finish_button %} | ||
<span class="chat-button" id="finish-button">Submit for evaluation</span> |
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.
@ArturGaspar It might be better to disable this button until there's a user response. What do you think?
<span class="chat-button" id="finish-button">Submit for evaluation</span> | ||
{% endif %} | ||
<textarea id="user-input" rows="1" placeholder="Type your answer here" maxlength="1000"></textarea> | ||
<span class="chat-button" id="submit-button">Submit <i class="fa fa-paper-plane"></i></span> |
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.
Same here.
else: | ||
message = self._get_agent_response(agent, user_input) | ||
character_name = self._get_character_name(agent) | ||
character_data = self._get_character_data(character_name) |
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.
Isn't the character_name
and character_data
being fetched within _get_agent_response
function too? Couldn't we just pass that info back instead of calling them again?
Description
Adds an XBlock similar to the short answer one, but which can select between different instructions for the LLM depending on context.
Testing instructions
The below example with the default settings shows how to test this functionality.
Other information
Private-ref: https://tasks.opencraft.com/browse/BB-9325