Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

image with ash_ai

Langchain gives a way to send images via base645 encoding docs here How to call that from ash_ai ? basically, this block from langchain docs ...

Policies don't allow to load relationships

I had simple policies and two resource if user is superadmin, then he is granted access if user has location access and permission access, both true, then he is granted access ...

Ash ai error when generating embddding

When trying to use Ash AI to generate a embedding, I got the error: * (Oban.CrashError) (throw) {DBConnection, #Reference<0.1746484685.788004865.129140>, #Ash.Changeset<domain: Qst.Templates, action_type: :update, action: :ash_ai_update_embeddings, attributes: %{full_text_vector: Ash.Vector.new([0.007031387183815241, -0.009794930927455425, ...]), updated_at: ~U[2025-06-21 06:34:27.031518Z]}, relationships: %{}, errors: [%Ash.Error.Unknown.UnknownError{error: "** (FunctionClauseError) no function clause matching in Pgvector.new/1", field: nil, value: nil, splode: Ash.Error, bread_crumbs: [], vars: [], path: [], stacktrace: #splode.Stacktrace<>, class: :unknown}], data: %Qst.Templates.QuestTemplate{id: "97eee691-64df-47e0-900a-9e8eaff83a25", name: "Dragon Slayer", description: "Epic dragon quest", inserted_at: ~U[2025-06-21 06:34:26.256243Z], updated_at: ~U[2025-06-21 06:34:26.256243Z], creator_id: "0a622c8d-6d03-4ca6-bef9-84795f3d8d7d", full_text_vector: #Ash.NotLoaded<:attribute, field: :full_text_vector>, task_templates: #Ash.NotLoaded<:relationship, field: :task_templates>, creator: #Ash.NotLoaded<:relationship, field: :creator>, meta: #Ecto.Schema.Metadata<:loaded, "quest_templates">}, context: %{changed?: true}, valid?: false>} It seems the embedding is returned correctly but can't convert to Pgvector. Does anyone has similar issue? Thanks a lot....

ash extensions

I want to write an ash extension that works with ANY action. it is a custom validator + resolver Aim: Validates that file exits and resolves the relative path to absolute path. Ideally this DSL would do ...

AshMoney with Ash.Generator

Hi, I have a resource that has an AshMoney attribute. When trying to create to with Ash.Generator I'm getting the following error ```...

How to re-use a resource as an argument type inside {:array, ...} ?

This does not work: ``` argument :elements, {:array, :struct}, allow_nil?: false, constraints: [instance_of: MODULE]...
Solution:
You can make a map type and set graphql_define_type? to false, and graphql_input_type to something like {:list, :some_input}

archive_related_authorize? doesn't exist anymore, how do I replace this behavior?

I'm getting forbidden policy checks on a cascading soft destroy.
Solution:
Ah, okay, I didn't realize we hadn't shipped 2.0

how to return a not_found error from a manual

i need return a not found error, with the error code, from a call on ash_json_api, the action its a manual action someone can help please 😄...

Simple prompt in custom action or iex shell

I can't seem to figure out how to do a simple prompt i.e. one prompt - one response. What would be the simplest way using AshAi? How could I do it directly in shell? I was playing around AshAi.Actions.Prompt.run/3 but couldn't grok it. ```...

aggregates of list with various filters

I know there are aggregates and have worked with them already. But so far, aggregates work somewhat only on a "row"-level of a resource (hope I got that correct) Is there an easy way to support on "resource"-level?...

ash_authentication update totally breaks a signed in user

If i was already logged in, i get redirected to the login page, but it's perptually redirecting me with the attached log

AshAuthentication confirmation page not using correct layout

The page served for /auth/user/confirm_new_user?confirm=longtokenhere does not appear to be using my application's layout template, because it does not have any of the elements in <head> that the rest of my app has. My router looks like this: ```elixir defmodule MyAppWeb.Router do use MyAppWeb, :router...
Solution:
If I explicitly pass path: "/auth/user/", then the root layout is used. I'm now thinking the URL I send in the email is incorrect.

sign-in tokens or not

Spun out from https://discord.com/channels/711271361523351632/1385038293284159588 When would you want to disable sign-in tokens?...
Solution:
if you had a massively high traffic system, or a custom authentication setup, you might not need them

Generating liveview - no users shown

After using ash-hq installer I continued with:
mix ash_phoenix.gen.live --domain MyApp.Accounts --resource MyApp.Accounts.User --resource-plural users
mix ash_phoenix.gen.live --domain MyApp.Accounts --resource MyApp.Accounts.User --resource-plural users
But /users doesn't list the users (there is one - my own). Console says
[debug] MyApp.Accounts.User.read: skipped query run due to filter being false"
[debug] MyApp.Accounts.User.read: skipped query run due to filter being false"
...

Installer fails because of postgres password

When using the installer from ash-hq: ``` mix archive.install hex igniter_new --force mix archive.install hex phx_new 1.8.0-rc.3 --force ...

Can't publish the same action twice

Hello, I have a challenge with notifications that I don't know how to solve. Would appreciate any advice! When an interaction that is part of the session is updated, I want to sent notification to both the interaction and the session. The below doesn't work: ```elixir pub_sub do...

What's the best way to sort records returned from `:create` action?

I want the records returned from a create action to be sorted by some related record fields. I'm loading the relationship in the create call, but not sure how to do the sort.
Solution:
Yeah, at the moment I don't think there is a way to sort them by some custom criteria

Foreign key reference naming and Ash.Generator

On my resource I have: ``` references do reference :region, name: "FK_dfwoyi1w884tqx68rctmbut4u"...
Solution:
regression perhaps? want a failing pr submitted to ash_postgres?

Ash.Vector clashing with Pgvector

Hey, I need help with the following error. Is there a setup step that I'm missing with Ash.Vector? ``` Unknown Error * ** (FunctionClauseError) no function clause matching in Pgvector.new/1...
Solution:
Ah, I think I found it. Maybe there should be a link to the setup instructions in AshPostgres.Extensions.Vector documentation from the Ash.Vector docs. Ash Vector: https://hexdocs.pm/ash/Ash.Vector.html AshPostgres.Extensions.Vector: https://hexdocs.pm/ash_postgres/AshPostgres.Extensions.Vector.html...