anilcancakir/laravel-ai-sdk-plus 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

anilcancakir/laravel-ai-sdk-plus

最新稳定版本:v0.1.6

Composer 安装命令:

composer require anilcancakir/laravel-ai-sdk-plus

包简介

Laravel AI SDK Plus — A fork of the official Laravel AI SDK enriched with custom features.

README 文档

README

Laravel AI SDK Plus

Laravel AI SDK Plus

A fork of the official Laravel AI SDK enriched with additional features. This package is kept in sync with the upstream laravel/ai repository as closely as possible — all core functionality remains identical.

Installation

composer require anilcancakir/laravel-ai-sdk-plus

Note: This package replaces laravel/ai. You should not have both installed at the same time.

What's Different?

Everything from the official Laravel AI SDK works exactly the same. This fork adds the following features on top:

Agent Skills System

A file-based, discoverable system that allows AI agents to dynamically load domain-specific instructions and reference files at runtime. Skills are Markdown files with YAML front matter, placed in resources/skills/.

class DesignAgent extends Agent
{
    use Skillable;

    public function skills(): iterable
    {
        return ['wind-ui'];
    }
}

Thinking / Extended Reasoning

Configure thinking/reasoning behavior per agent using the #[Thinking] attribute. Works across all major providers with automatic parameter mapping.

use Laravel\Ai\Attributes\Thinking;

#[Thinking]                        // Enable with defaults
#[Thinking(effort: 'low')]         // Reasoning effort (OpenAI, Gemini, OpenAI-Compatible)
#[Thinking(budgetTokens: 10000)]   // Token budget (Anthropic, Gemini)
#[Thinking(effort: 'high', budgetTokens: 16000)] // Both
Provider Parameters
Anthropic thinking.enabled, thinking.budgetTokens
OpenAI reasoning.effort
Gemini thinkingBudget, thinkingLevel
xAI thinking.enabled
Ollama thinking
OpenAI-Compatible reasoning_effort

OpenAI-Compatible Provider

Support for any OpenAI-compatible API endpoint (LocalAI, Ollama, vLLM, LiteLLM, etc.) as a first-class provider.

// config/ai.php
'providers' => [
    'my-provider' => [
        'driver' => 'openai-compatible',
        'key' => env('MY_PROVIDER_API_KEY'),
        'url' => 'https://api.my-provider.com/v1',
        'models' => [
            'default' => 'gpt-4o',
            'image' => 'image-model',
        ],
    ],
],

Text Generation

use Laravel\Ai\Ai;

$response = Ai::textProvider('my-provider')
    ->prompt('Explain quantum computing in one sentence.');

Image Generation

Generate images through any OpenAI-compatible service that supports image generation via the chat completions endpoint:

use Laravel\Ai\Image;

// Basic image generation
$response = Image::of('A cat wearing a top hat')->generate('my-provider');

// Access the generated image
$response->firstImage()->image; // Base64 content
$response->firstImage()->mime;  // e.g. 'image/png'

// Save to disk
$response->store('images', 'public');

// With size and quality options
Image::of('A futuristic cityscape')
    ->landscape()
    ->quality('high')
    ->generate('my-provider');

// With reference image attachments
use Laravel\Ai\Files\Image as ImageFile;

Image::of('Make this image more vibrant')
    ->attachments([
        ImageFile::fromPath('/path/to/reference.jpg'),
    ])
    ->generate('my-provider');

Set a default image provider to skip specifying it every time:

// config/ai.php
'default_for_images' => 'my-provider',

// Then simply:
Image::of('A mountain at dawn')->generate();

Documentation

For core SDK documentation, refer to the official Laravel AI SDK docs.

Upstream Sync

This fork tracks the 0.x branch of laravel/ai. Upstream changes are merged regularly to stay current with the official release.

License

Laravel AI SDK Plus is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 208
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固