sid405's avatar

sid405 wrote a comment+100 XP

3w ago

If anyone ends up getting 400 errors form OpenAi on tool calls: https://github.com/laravel/ai/issues/313

sid405's avatar

sid405 wrote a comment+100 XP

1mo ago

Perhaps it'd be worth completing the messages() method in the agent in the previous video otherwise this one won't work

Something along these lines


    public function messages(): iterable
    {
        return TicketMessage::where('ticket_id', $this->ticketId)
            ->get()
            ->map(function (TicketMessage $message) {
                $role = is_null($message->user_id)
                    ? Laravel\Ai\Messages\MessageRole::Assistant
                    : Laravel\Ai\Messages\MessageRole::User;

                return new Laravel\Ai\Messages\Message($role, $message->body);
            })->toArray();
    }