We need prompt chains: Allow custom AI persona tools to access LangChain.js and/or longer execution time

While hooking up the AI bot to external APIs has been quite awesome, I think that it would be very useful for admins/devs to be able to build prompt chains using LCEL :link: in the custom tool editor in order to allow for more complex workflows and turbo-boosted intelligent responses. Or perhaps the custom tool editor could have a “chain builder” functionality that essentially just wraps up LangChain into a GUI for the admin :toolbox:.

Alternatively, it would be super useful to allow an execution time of longer than two seconds so that a prompt chain can be hosted on a different servers and exposed to the Discourse server. 2 seconds is long enough to send the chain some data, let it “think” through its chain, then get an answer back :brain:. But this is more complex and niche, and less friendly for non-engineers. The first proposition makes more sense.

Of course both of these options introduce potential risks, so ideally there’d be a toggle to enable with a warning/notice attached :warning:.

But why even do this? Well, I’m glad you asked :smiley: . :robot:

Complex AI behavior / agency is not really achievable with a single system prompt alone, and that’s precisely why LangChain was developed. I’m an AI researcher :nerd_face: and we’re building a (for now) simple LLM-based agentic cognitive architecture which will eventually be interacting with users :mechanical_arm:. Discourse would be the most ideal medium by which we can unleash this beast, especially since it can be coupled with the automations plugin — the possibilities are truly endless here and I love it :heart_eyes:.

I’m confident that many other companies that would benefit from being able to apply agents to their forums as well. LLMs are quite impressive, however we recognizes that elements of symbolic (logic/rule-based) AI are still applicable within larger AI systems — such as cognitive architectures which are built to optimize towards a particular goal state.

:heart: I would love to hear any feedback, brainstorming, and critiques of this idea! :heart:

I read and understand words, and that’s it - because I’m an end user lacking basic knowledge and understanding. And I’m not totally sure if you are actually trying to sell a B2B concept or something useful to users in a forum environment. Or both, that is a possible situation too.

Sure, it is good to have a big variety of tools and there is no reason that everyone should use every tool. It is good to have a big enough stock to choose from.

Can you give practical examples of what all of that can give to the business behind a forum and for an user?

1 Like

Good points :smiley: Thanks for your reply

One could think up an infinite of use-cases connecting LLMs together to achieve a goal, but here’s a simple down-to-Earth example…

Say there is a forum for researchers who need to find new research papers quickly and easily. One could just use the already-available http library in the AI plugin custom tool builder, then make a tool which sends a request to some database of papers (for example arXiv or peer-reviewed academic journal). But this is essentially just a “one-shot” attempt.

A better approach would be to chain together multiple LLM calls to take a step-by-step approach to the problem:

  1. chat with the user about what their research topic is (loop this a few times to get lots of details)
  2. summarize the user’s needs according to a predefined template
  3. turn that summary into a API request and receive a list of potential matches from the database of papers
  4. analyze the abstract of each paper to ensure its actually relevant
  5. present that list to the user and explain why each paper is relevant to their research topic.

This isn’t what I am working on (I don’t necessarily want to hand out my business model and architecture :smiley: ), but it is a simple and realistic example which is actually being addressed by some developers.

Essentially what I am trying to sell users (via the lovely subscriptions plugin) is access an AI bot that is more complex than just a system prompt with a simple tool hooked up to some service which shoots back some data (stocks prices, etc.). More complex in the sense that it solves a problem / addresses a user query in multiple steps, each step utilizing an LLM with a different system prompt. This is essentially what the new OpenAI o1 model does. :blush:

1 Like

If you intend to make money from this, perhaps it’s reasonable you PR the capability? Have you considered that?

I believe they are adding support for o1, so why not stick with that?

Chatbot may already work with o1 which I will confirm when I can actually test it without spending even more money on my account to reach Tier 5! :moneybag: :moneybag: :moneybag:

2 Likes

I definitely have considered that but as an AI researcher my programming experience/knowledge is concentrated in Python and libraries such as NumPy, PyTorch, etc :nerd_face:. I know nothing about Ruby and very little about JavaScript. Although since I have fallen in love with Discourse, I have a resolution to slowly begin learning these as well as Discourse plugin development. :sweat_smile: So if you have any recommendations for learning resources then I’d be thankful!

o1 is nice and useful, and I predict I’ll be using it often for coding, however what I am working on is a cognitive architecture so its a bit of a different situation. I’m rather in the mindset of “I want to build something based on research in the computational cognitive sciences, and it’d be cool if it could sell” and not really “I have an idea and I can offload it to OpenAI and rake in cash”. I hope that makes sense :stuck_out_tongue_winking_eye: .

Oh yeah, and our cognitive architecture would be ~20 times cheaper than o1 :grimacing:

1 Like

Yeah, o1 is crazy expensive right now! :grimacing:

Learn by doing, first copying existing plugins and first choosing low hanging functional fruit to make it an easier iterative process. Make something you really need, because you will need the incentive to overcome the barriers you meet.

1 Like