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

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

Postgresql error after migrating to ash_archival

I get this error: * ** (Postgrex.Error) ERROR 42703 (undefined_column) column "archived_at" does not exist After running the migration of AshArchival on my User resource It didn't create the archived_at column for some reason...
Solution:
Did you run mix ash.codegen to generate migrations?

AshAI tool calling: framework does not automatically run the tool?

I'm working through my first tool calling experience in a LiveBook as a learning exercise. AshAI is adding a %LangChain.Function{} to the chain's tools list, and the LLM responds with :assistant role Message containing the %LangChain.Message.ToolCall{} 🎉 I suppose I expected the magic to continue, that the framework would intercept that ToolCall, automatically run the tool, and then respond with a :tool result message to continue the chain. ...
Solution:
Yeah, LLMChain.run takes a mode option

AshAuthentication require confirmation not working

I am going through the Confirmation Tutorial, and even though I have added require_confirmed_with to the password strategy block, I can still log in before visiting the confirmation URL in the email. Worth noting that I started adding AshAuthentication to my application before the Igniter installers were added, so my resources may be missing some optional-but-recommended blocks that the installers add.
Solution:
Okay, fix released, docs updated

AshPhoenix.Form.submit is triggering change function to run twice

Say I have a custom change module, like so: ```elixir defmodule MyApp.Accounts.Changes.MyCoolChange do use Ash.Resource.Change...

Accessing relationship fields inside Ash.query.filter

I have this: ``` defp user_query(context) do User |> Ash.Query.select([:first_name, :last_name])...

Define Ash Type for Ash Resource with Data Layer?

Embedded Ash resources are automatically Ash Types. Can Ash resources with data layers automatically define a type, as well?

Filtering inside a load

Hopefully an easy one. I have a code interface that I'm calling inside a calculation module like this: ``` defp calculate_least_engaged(organization, after_datetime, before_datetime) do descendant_orgs = Organization.get_descendant_organizations!([organization.id], load: [users: [:first_name, :last_name]]) ......

AshGraphQL or query does not parse to correct sql

query: SELECT d0."id", d0."user_id" FROM "doctors" AS d0 LEFT OUTER JOIN "public"."users" AS u1 ON d0."user_id" = u1."id" WHERE (ash_elixir_or(u1."id"::uuid, ARRAY[$1,$2]::uuid)) AND (d0."entity_id"::uuid = $3::uuid::uuid) ORDER BY d0."id" LIMIT $4
query: SELECT d0."id", d0."user_id" FROM "doctors" AS d0 LEFT OUTER JOIN "public"."users" AS u1 ON d0."user_id" = u1."id" WHERE (ash_elixir_or(u1."id"::uuid, ARRAY[$1,$2]::uuid)) AND (d0."entity_id"::uuid = $3::uuid::uuid) ORDER BY d0."id" LIMIT $4
this log is from a query ```gql...

Logging in via the API

Working through authorizing api access for authentication and cant seem to login via the api, however I am able to create an account via the api
No description

How to use date_range filter in Cinder.Table

Hey @Rebecca Le first of all, great work with this project. Our custom hacky data table with pagination broke with some deps.update and i added this so quickly without any effort 🙌 Now i am trying to use the date time range filter but when picking any date it raises ```elixir ** (Protocol.UndefinedError) protocol String.Chars not implemented for type Ash.Query (a struct)...
Solution:
can you try main again? have just pushed another fix (and include_time should work properly now as well)

Ash ai prompt wrapper

Moving the question here from the ash development channel: Boris - BackedBy — 08:13 Every time I submit an LLM request, I also submit evaluation criteria. After receiving the main response, I have a validation model respond with 'true' or 'false' re whether the response fits the evaluation criteria. The logprob of the 'true' token is then used as a numerical score for how well the LLM responded. What would be the best approach for extending the ash ai prompt-backed action to have optional criteria: [list of strings] and validation_model: string definitions to run the validation step? Zach Daniel — 08:15 As it stands right now, your best bet would likely be to create a "wrapper" around the prompt action implementation ...

AshGraphQL cannot return null on non nullable field

I have a belongs_to allow_nil? false relationship, and when I use psql I see that the field exists, and the related table contains the data. However when I use graphql to access it I get Cannot return null for non-nullable field
Solution:
do you have permission to read the related record?

"Right" way to do conditional forms

Hello, first of all, thanks for all the work with Ash, it's being incredible and I'm very happy to using it. It's really awesome. I'm facing a challenge here, and just have some questions if maybe there is a way that AshPhoenix forms can help me here. I have a very complex form, where several inputs change based on the selection of some attributes. ...
Solution:
I think you'll essentially need to clean up the UI and/or model your input to the action as a union, and use the union form guides.

Is this possible to encode as a policy?

``` bypass action(:my_action) do authorize_if expr(
^context(:organization_id) == ^tenant() and ^context(:some_key) == ^arg(:some_other_key)...

Runtime values in Filter

I'm trying to achieve the following ecto query in filters ``` def inserted_today(query, user) do query...

"The CLDR provider module Cldr.XYZ.Backend was not found"

Running the "install now script" from the web home page leads to a project with this error. In particular, I executed: ``` mix archive.install hex igniter_new --force...
Solution:
Alright, done!

Using config values in filter expressions

I have a fairly simple read action, like so: ```elixir read :get_by_id do get? true...

Should reusing a used magic link redirect to the sign in screen?

Currently working on tunez and have just added magic_link auth. I at the portion where I am testing out reusing an old magic link for section Debugging when authentication goes wrong and noticed it doesn't redirect back to home or the sign-in and no error toast is shown, is this expected behaviour? (sorry for 480p video, but had to make it under 10MB to post)