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

Port conflict when running new app built using Ash installer

I used the Ash installer to generate a new app: ``` mix archive.install hex igniter_new --force mix archive.install hex phx_new 1.8.0-rc.3 --force...

ash ai chat

``` [error] ** (NimbleOptions.ValidationError) unknown options [:unsafe_], valid options are: [:hardbreaks, :github_pre_lang, :full_info_string, :width, :unsafe, :escape, :list_style, :sourcepos, :escaped_char_spans, :ignore_setext, :ignore_empty_links, :gfm_quirks, :prefer_fenced, :figure_with_caption, :tasklist_classes, :ol_width, :experimental_minimize_commonmark] (in options [:render]) (nimble_options 1.1.1) lib/nimble_options.ex:359: NimbleOptions.validate!/2 (mdex 0.7.1) lib/mdex.ex:1376: MDEx.validate_options!/1 (mdex 0.7.1) lib/mdex.ex:951: MDEx.to_html/2...

Cinder.Table count timeout not working as expected

Hey @sevenseacat i saw that there was a new version with fixes for the timeout and this issue was closed (https://github.com/sevenseacat/cinder/issues/7) But i'm still getting the same error even when setting the query_opts={[timeout: :timer.seconds(20)]} ```elixir 11:52:17.499 [error] Task #PID<0.16899.0> started from #PID<0.16897.0> terminating...
Solution:
I can fix that

Auto generated `reset_password_with_token` not loading user

Hi everyone! ๐Ÿ‘‹ Iโ€™m trying to expose the auto-generated reset_password_with_token action via Ash GraphQL, but I keep getting a not_found error no matter what I try. Hereโ€™s my setup (auto generated): ```...
Solution:
seems like: ``` bypass action(:read) do authorize_if expr(id == ^actor(:id)) end...

Is there a way to overwrite `:langchain` to specify to use custom forked version?

I found Ash.AI is really cool. However, I need to interact with other LLM provider that doesn't supported by {:langchain, "~> 0.3"}. So, I need to fork the langchain and plan to write modules for that provider. When I specifiy my forked repo in phoenix's mix.exs, it failed at setep: mix deps.get with error: Because every version of ash_ai depends on langchain ~> 0.3 which doesn't match any versions, no version of ash_ai is allowed....
Solution:
Use `override: true' in your custom langchain dependency

Problems with AshRateLimiter

After spamming in the general channel I was redirected here ๐Ÿ˜… I'm trying to setup AshRateLimiter but it crashes when I test a rate limited action giving me undefined Hammer.hit function. I thought AshRateLimiter would pull in the Hammer lib? I installed it and configured it manually and it works The problem I then got is that now it's warning: reset_password_with_token cannot be done atomically, because the changes [AshRateLimiter.Change] cannot be done atomically But I'm not rate limiting that action, it shouldn't be affected (I think?)...

Managing many_to_many relationships with AshPhoenix.Form

Hi all, I'm really struggling to get AshPhoenix.Form to manage a many to many relationship. I have 2 resources, Organizations and Users. I have a many_to_many relationship between them. What I'm trying to achieve, is that when I create/edit an organization, there should be a multi select to be able to select related users. ``` create :create do...
Solution:
Like fetching the possible users and assigning them on mount

destroy + create behavior on has_one relationship

is there a way to have manage_relationship with: - destroy the previous has_one - create a new one from what i understand, it's not quite append_and_remove, because it requires an update to the target record....

How to create a Union query within different resources with Combination

Looks like the api to perform a Union query is https://hexdocs.pm/ash/combination-queries.html but what would be the best way to create a union query between different resources?

Ash Framework Book: Missing filepath's for code changes in Chapter 7

Are we supposed to implement these changes? Im on version B6.0 of the book using epub
No description

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. ```...