Skip to content

Story/internal 501 update to langchain to 0 3 1 on chatbot ex #17

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

xhr15
Copy link
Member

@xhr15 xhr15 commented Mar 10, 2025

rag 0.2 is not released yet. We should do that by Wednesday. When done, we should update the blogpost (see below) and check that code examples still run

Add rag as dependency and run mix deps.get.

  defp deps do
    [
      {:rag, github: "bitcrowd/rag"},
      ...
    ]
  end

xhr15 added 4 commits March 10, 2025 18:30
The assistant gets a bit to funny in it’s answers 😄 

https://bitcrowd.atlassian.net/browse/INTERNAL-499
LLM frequently use Markdown to structure their output. sth like \

    # lib/chatbot_web/live/chat_live.ex
    # (..)
      markdown_html =
          String.trim(assigns.content)
          |> Earmark.as_html!()
          |> Phoenix.HTML.raw()

        assigns =
          assigns
          |> assign(:class, "u-max-width-75 u-bg-white " <> justify_self)
          |> assign(:markdown, markdown_html)

        ~H"""
        <.ui_card id={@id} class={@Class}>
          <%= @markdown %>

https://bitcrowd.atlassian.net/browse/INTERNAL-500
…chatbot.ex

Langchain.ex has progressed to 0.3.1. We should update to that. However,
it introduces a breaking change:

    Compiling 10 files (.ex)
        error: module LangChain.Utils.ApiOverride is not loaded and could not be found
        │
     12 │   import LangChain.Utils.ApiOverride
        │   ^
        │
        └─ lib/chatbot/llm_mock.ex:12:3: Chatbot.LLMMock (module)

The background is
[this PR](brainlid/langchain#155):

> This change includes the Mimic testing library for mocking out live
> calls and forcing a specific return value.
>
> Originally, was using `LangChain.Utils.ApiOverride` which provided
> process-level result overrides. However, it had the negative
> requirement of requiring testing-aware to be in the production code,
> specifically in the ChatXYZ.call functions.
>
> Using Mimic removes that requirement, keeping the production level
> code cleaner.

The reasoning is sound, however, it crashes with what we do in
`Chatbot.LLMMock`. As LLM Mock is not used in tests (and `LLMMock` does
not have tests itself), I would take it out for now.&#x20;

https://bitcrowd.atlassian.net/browse/INTERNAL-501
@joelpaulkoch joelpaulkoch self-requested a review March 11, 2025 16:47
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