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

Bugfix: Added changes to update prompt for webapps #306

Merged
merged 6 commits into from
Feb 26, 2024

Conversation

venkatajagannath
Copy link
Collaborator

The PR makes the following changes:

  1. Updates the request object to include a client variable to capture information on which client is sending the request. This information will be used to update the prompt & also for capturing metrics on requests per client type. Currently there are two client types - slack & webapp
  2. For each of the client types - slack and webapp, we add conditions to update the relevant request variable
  3. When the request is received from a webapp, then the prompt to LLM is updated to specify that we must return the result in markdown format

Copy link

cloudflare-pages bot commented Feb 26, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8c2899d
Status: ✅  Deploy successful!
Preview URL: https://36472956.ask-astro.pages.dev
Branch Preview URL: https://user-venkat-bugfix.ask-astro.pages.dev

View logs

@venkatajagannath venkatajagannath linked an issue Feb 26, 2024 that may be closed by this pull request
Copy link
Collaborator

@jlaneve jlaneve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! at some point we should think about templating the prompt if we run into more replace cases like these

@venkatajagannath venkatajagannath merged commit 6fe2ece into main Feb 26, 2024
8 checks passed
@venkatajagannath venkatajagannath deleted the user/venkat/bugfix branch February 26, 2024 23:03
@davidgxue
Copy link
Collaborator

Thank you Venkat for the quick turn around. Just a quick question: were you able to test that the new prompt works by producing a new URL format in the response generated?

@venkatajagannath
Copy link
Collaborator Author

Screenshot 2024-02-26 at 6 21 46 pm

Hey David, please see screenshot

Copy link
Collaborator

@davidgxue davidgxue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 1 issue that is causing an error in the main branch.

Also, can we verify this change works with firestore? Maybe historical data will not be backfilled which is fine, but are we able to know that for new requests new docs in the firestore db has this new field?

@@ -105,4 +107,5 @@ def from_dict(cls, response_dict: dict[str, Any]) -> AskAstroRequest:
response_received_at=response_dict.get("response_received_at"),
is_processed=response_dict.get("is_processed", False),
is_example=response_dict.get("is_example", False),
client=response_dict["client"],
Copy link
Collaborator

@davidgxue davidgxue Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be something like response_dict.get("client", "unknown") since there's no backfill for current firestore data, meaning previous firestore data will not have this field. Currently main branch due to this PR merged is getting this error ERROR:ask_astro.rest.controllers.list_recent_requests:Error while fetching recent requests: 'client' because of it.

I can make a new PR to fix this

davidgxue added a commit that referenced this pull request Mar 7, 2024
…312)

### Description
- A previous PR didn't test thoroughly and had a bug so that it did not
address the problem.
- Previous PR: #306 
- Goal is to have different system prompt for different slack vs webapp
client
- The previous PR was modifying the user's question prompt not system
prompt

### Related Issue
closes #301 
This issue is supposed to be fixed in 0.3.0, but due to inadequate
testing during that PR merge, it wasn't caught that the PR didn't
address the problem. The bug is re-discovered after 0.3.0 release.

### Tests
1. Sent a request on front end
2. Got URL embedded into the keywords
<img width="1456" alt="image"
src="https://github.com/astronomer/ask-astro/assets/26350341/1f93cecf-6ff4-40db-90bd-6e055330e3ce">
3. Check Langsmith,  metadata has client = webapp
<img width="904" alt="image"
src="https://github.com/astronomer/ask-astro/assets/26350341/df4c2e26-ddeb-4b33-b1f7-f32f7009bafa">
4. Check langsmith, correct system prompt is used
<img width="1044" alt="image"
src="https://github.com/astronomer/ask-astro/assets/26350341/3245201d-73ed-4ebc-b4fe-7deff770cc4a">

[Langsmith
link](https://smith.langchain.com/public/37f44ef4-af11-45a5-8246-e7f2b1997b58/r)
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.

URL on Website UI Not Correctly Formatted
3 participants