Learning by doing (Peloton AI Trainer)

November 12, 2023

For most of the past week I've been working on a rewrite of the Peloton AI Trainer. I added a chat interface for the user to have more control over the workout being generated. The model starts by recommending the best workout based on the user preferences, but things happen. There are days where you might be sore and need a little extra break or shift focus to another body part. The chat feature allows the user to provide that information.

User preferences are now managed within the UI instead of in a JSON file making for a much better user experience. There are also some UI updates by pushing some options to the left sidebar instead of dealing with nested buttons in Streamlit. As the app became more complicated the initial Streamlit layout was getting too complicated. This simplified layout should be easier to extend capabilities going forward.

There are still some usability issues I need to work through, but I'm happy with the progress so far. I still don't plan to host this service, but that could change as it becomes more polished.

I finished the LangChain for LLM Application Development course. My plan was to integrate LangChain into the app. As I began integrating LangChain into the app I began to realize the benefits of doing so for this use case were not significant enough to justify the effort.

For this use case the main LLM activities are to:

  • Make a call to the OpenAI API.
  • Parse the responses.
  • Make string substitutions for the prompts.
  • Maintain the conversation history.

Inside this app all of these can be completed with a few functions. Carrying around the extra baggage of an abstraction layer for these functions is not worth it.

Another reason is the LangChain docs are a mess. I tried to reconcile what was covered in the course with the docs and it was a disaster. An example is the secion on adding memory to a chain. The documentation contains nothing but code snippets. Having code examples are a start, but there is zero intuition to go along with the code so the user knows why each step is being taken, common customizations and guidance how each step should be implemented.

The lack of good documentation on the LangChain site means there could be a good opportunity to write my own to fill that gap. I have an idea for a project where I can see the value of the LangChain abstractions, so this is not the end of LangChain for me.