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

Update functionality of thumb up/down buttons in UI to update thread checkpoint metadata score #338

Merged
merged 10 commits into from
May 16, 2024

Conversation

andrewnguonly
Copy link
Contributor

@andrewnguonly andrewnguonly commented May 15, 2024

Summary

DO NOT MERGE. This is a test branch to demonstrate self-learning/optimization use cases. After the demonstration is complete, this PR can be closed.

The functionality of the 👍 and 👎 buttons are updated to update the thread checkpoint metadata score. The OpenGPTs backend calls the LangGraph API PATCH threads/<tid>/state endpoint to do the update.

Implementation

  1. OpenGPTs backend: Add PATCH api/threads/<tid>/state endpoint to allow client to update thread checkpoint metadata score.
  2. Update OpenGPTs UI feedback buttons to call the new API.
  3. Convert the Assistant bot to a self-learning bot (i.e. uses FewShotExamples managed state).
  4. Lint and format all backend and frontend files.

To Do

  • Update langgraph-sdk after a new release is cut
  • Test changes
  • Create self-learning/optimization assistant
  • Remove the "Self-Learning Assistant" from the frontend and backend. We'll use the regular assistant instead.
  • Send score to both LangSmith and FewShotExamples

Next Steps

  1. Implement custom graph that can "self learn/optimize". Branch off of this branch to make this change.

@andrewnguonly andrewnguonly changed the title [DO NOT MERGE] Update functionality of thumb up/down buttons in UI to update thread checkpoint metadata score Update functionality of thumb up/down buttons in UI to update thread checkpoint metadata score May 16, 2024
@@ -67,8 +67,11 @@ function App(props: { edit?: boolean }) {
},
];

if (assistantType === "chat_retrieval" || assistantType === "chatbot") {
// The RAG assistant type requires an object with a `messages` field.
if (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This if-statement isn't needed anymore since all chatbots use StateGraph with messages key.

if not thread:
raise HTTPException(status_code=404, detail="Thread not found")
assistant = await storage.get_assistant(user["user_id"], thread["assistant_id"])
if not assistant:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This check is not needed. We want to support patching thread state metadata even if the assistant has been deleted.

@andrewnguonly andrewnguonly merged commit 99e01f7 into nc/26apr/langserve May 16, 2024
3 of 6 checks passed
@andrewnguonly andrewnguonly deleted the an/15may/self-learning-optimization branch May 16, 2024 23:31
nfcampos pushed a commit that referenced this pull request Jun 18, 2024
…checkpoint metadata score (#338)

* Update functionality of thumbs up/down buttons in UI to update thread checkpoint metadata score.

* Fix bugs with calling PATCH threads/<tid>/state API.

* Update frontend to expose Self-Learning Assistant.

* cr

* Fix bug in backend to make sure that agent graph returns dict graph state. Update frontend so that agent API call send dict.

* Call tool node should return dict.

* Update API call for updating tool messages.

* Restore functionality for sending feedback to LangSmith.

* Remove Self-Learning assistant.

* Small updates.

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
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.

2 participants