bradley

bradley

I’ve been developing Ash resources and noticed that while AI tools work well when I provide existing examples, they struggle when creating new resources or tackling less-documented use cases. I’m exploring ways to improve AI responses by incorporating the Ash documentation.

One idea is to use the newly released Model Context Protocol from Anthropic, combined with a Retrieval-Augmented Generation (RAG) system, AWS Bedrock Knowledge Bases, or tools like Cline. This would involve downloading HEX docs for the Ash libraries, feeding them into a RAG system or knowledge base, and making them accessible for AI queries.

However, there are some challenges:

  • Ash documentation is extensive, covering multiple libraries within the ecosystem.
  • The docs are constantly updated, so I’d need a way to keep them in sync.

Alternatively, I’m considering whether the Model Context Protocol could directly access Ash documentation without requiring the setup and maintenance of a separate RAG system.

While this problem is most noticeable with Ash, it’s not unique to it—it applies to any HEX library. However, Ash is where I’ve experienced the most issues, as LLMs tend to wildly make things up when attempting to assist with it.

Before diving in, I’d like to ask:

  • Has anyone tried a similar approach?
  • Are there simpler solutions or existing tools for integrating HEX library documentation with LLMs effectively?

Any insights or suggestions would be much appreciated! :folded_hands:

Showing Posts 1 to 10

zachdaniel

zachdaniel

Creator of Ash

I can’t contribute much to this conversation except to confirm that LLMs have no idea what they are talking about when it comes to Ash :slight_smile:

I think that custom training an LLM on reference docs, example apps, etc will be the only way to have something at least halfway decent.

mjrusso

mjrusso

Try this out: https://hex2txt.fly.dev

You’ll want to use the hex2context notebook, which tries to find and include only the most relevant sections of documentation. (I just shipped this ten minutes ago, and there’s tons of opportunities for improvement. Note that the notebook computes all embeddings locally, but swapping in paid models should be relatively trivial. I haven’t tested different embeddings models out yet; any real-world feedback would be super useful.)

To run the notebook: Run - Livebook.dev

Direct link to source: hex2txt/notebooks/hex2context.livemd at main · mjrusso/hex2txt · GitHub

bradley

bradley OP

Thanks for sharing! Just curious, how are you using this with your workflow? Do you have an approach that works well with any LLM tooling?

My first thoughts around how I’d use this is to integrate it into an MCP server so an MCP client could easily call Hex2context.ingest_docs/2 and Hex2context.retrieve_docs/2.

mjrusso

mjrusso

The workflow part is definitely a work-in-progress.

I have a (very simple) example session using Aider on the hex2txt homepage. The workflow for hex2context is similar, but you need to swap in the URL of your Livebook proxy instance (and change the URL structure slightly, pass in the query query string param, etc.). Clunky for sure.

I think that exposing an MCP server is the next step here. I haven’t reviewed the spec in detail yet but I would imagine that it wouldn’t be too hard to build a proof-of-concept MCP server directly in the Livebook.

(Unfortunately Aider doesn’t have MCP support (yet?) although I know Cline does, but I’m not personally planning on using Cline because of the VS Code dependency.)

felix-starman

felix-starman

I’m always curious about stuff like this. Is there a way for us to provide structured context to the large llm companies as well? I know this is slightly off topic, but the MCP stuff seems interesting and I’m curious if they have documented a way for people to provide information to them that they could train on so that the larger models that are trained by larger groups or corporations could include this in their training set.

Or a way to improve how the ash docs or just hexdocs in general are used to provide answers.

Seems like a missed opportunity since documentation in Elixir is so centralized, consistent, and high quality, compared to a mishmash of documentation in other ecosystems

mjrusso

mjrusso

I’m not aware of any mechanism for this (other than submitting to a corpus like Common Crawl, which are certainly being used to train on).

As for improving Hexdocs-in-general, @mayel is on it :slight_smile: https://github.com/elixir-lang/ex_doc/pull/1976

bradley

bradley OP

Just wanted to share an update, @mjrusso. I’ve been using hex2text alongside Cursor’s documentation indexing, and it’s been working pretty well. All I do is point it to the hex2text link for the library I need, and voila! I’d really love to see something like this integrated into Hex proper.

Overall, this workflow is decent, but Cursor’s index doesn’t always get utilized when I expect it to, and it still generates a fair amount of incorrect Ash code. That said, it’s still the best solution I’ve tried so far—better than Windsurfer, Copilot, Zed, Cline, and Aider.

Also, cursor just added support for MCP which is a bonus.

bradley

bradley OP

Just wanted to post an update—I finally got fed up with how Cursor was generating code, so I wrote my own MCP server. So far results are promising.

mikesax

mikesax

I tried to use Claude Code to create an Ash project the other day and unfortunately, it got hopelessly confused trying to generate and run Ecto migrations. So I am wondering if there has been any progress or tips to help AI aids “understand” Ash?

At least for now, regardless of Ash, nothing good comes from “vibe coding” without close supervision, but I have found that using Claude Code with regular Phoenix projects has saved lots of typing and looking up specific functions. As long as I take very measured steps (instructions) and read all the code it suggests as if I’d be typing it myself, it truly saves me time without compromising quality and elegance.

Ash makes me much more productive.

Claude Code can make me much more productive.

Is there a way to have both? :slightly_smiling_face:

bradley

bradley OP

Have you had a chance to try my MCP server yet? I usually point it to HexDocs ahead of time so it has the context of Ash before writing code. If it implements something incorrectly, I ask the AI to review the HexDocs before fixing the issue. That approach seems to work well for me, but your use case might be different, so it may or may not fit your needs.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
Stef-Verniers
Hello I’ve been coding in Elixir for almost two years now because of my current job where we implemented Elixir in our application. But ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews