Skip to content

Conversation

Ivor
Copy link

@Ivor Ivor commented Jun 16, 2024

The Replicate.Models.list/0 function currently breaks due to the API returning created_at as a field in the model response.

** (KeyError) key :created_at not found
    (replicate 1.2.0) anonymous fn/2 in Replicate.Models.Model.__struct__/1
    (stdlib 5.2.3) maps.erl:416: :maps.fold_1/4
    (elixir 1.16.3) lib/kernel.ex:2434: Kernel.struct!/2
    (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
    (replicate 1.2.0) lib/models.ex:163: Replicate.Models.list/0
    iex:1: (file)

This adds the field to the model struct as well as to the mock client's model response structure.
It also updates the Replicate.Models.Behaviour to require the opts keyword instead of the 7 arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant