All skills
asyrafhussin avatar

/laravel-ai-sdk

@7221662

Laravel AI SDK for building AI-powered features. Use when creating agents, generating images or audio, working with embeddings, vector search, or testing AI features. Triggers on tasks involving laravel/ai, AI agents, tool-calling, structured output, streaming, embeddings, reranking, or AI faking in tests.

Use this Skill: https://skilld.dev/gh/asyrafhussin/agent-skills/laravel-ai-sdk

This session only. Nothing lands on disk.

rulesfiles-vector-stores.md

≈742 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Files and Vector Stores for RAG

Impact: MEDIUM (Store files with providers and build searchable knowledge bases)

Store files with AI providers for repeated use in conversations. Create vector stores to build searchable document collections for retrieval-augmented generation (RAG).

Bad Example

// Re-uploading the same file on every prompt
$response = (new DocumentAnalyzer)->prompt(
    'Summarize this document.',
    attachments: [
        // This uploads the file every single time
        Files\Document::fromStorage('report.pdf'),
    ],
);

Good Example

// Store a file once with the provider
use Laravel\Ai\Files\Document;
use Laravel\Ai\Files\Image;

$stored = Document::fromPath('/path/to/report.pdf')->put();
$stored = Document::fromStorage('report.pdf', disk: 'local')->put();
$stored = Document::fromUrl('https://example.com/doc.pdf')->put();
$stored = Document::fromUpload($request->file('document'))->put();
$stored = Image::fromPath('/path/to/photo.jpg')->put();

$fileId = $stored->id;
// Reference stored file in conversations — no re-upload
$response = (new DocumentAnalyzer)->prompt(
    'Summarize this document.',
    attachments: [
        Document::fromId($fileId),
    ],
);
// Delete a stored file
Document::fromId('file-id')->delete();
// Create a vector store for RAG
use Laravel\Ai\Stores;

$store = Stores::create(
    name: 'Knowledge Base',
    description: 'Documentation and reference materials.',
    expiresWhenIdleFor: days(30),
);
// Add files to a vector store — auto-indexed for searching
$store = Stores::get('store_id');

$document = $store->add(Document::fromPath('/path/to/doc.pdf'));
$document = $store->add(Document::fromStorage('manual.pdf'));
$document = $store->add($request->file('document'));

// Add with metadata for filtering
$store->add(Document::fromPath('/path/to/doc.pdf'), metadata: [
    'author' => 'Taylor Otwell',
    'department' => 'Engineering',
    'year' => 2026,
]);
// Remove file from store
$store->remove('file_id');

// Remove and delete permanently
$store->remove('file_id', deleteFile: true);
// Use vector store with FileSearch provider tool
use Laravel\Ai\Providers\Tools\FileSearch;

public function tools(): iterable
{
    return [
        new FileSearch(stores: ['store_id']),
    ];
}

Why

  • Efficiency: Store once, reference by ID — no repeated uploads
  • RAG: Vector stores + FileSearch enable knowledge-base-powered agents
  • Metadata filtering: Filter search results by author, date, department, etc.
  • Provider support: OpenAI, Anthropic, Gemini for file storage

Reference: Laravel AI SDK — Files

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk MEDIUM
  • Gen Agent Trust Hub16d

    The skill provides a comprehensive guide for the Laravel AI SDK but contains deceptive metadata claiming authorship by the 'Laravel Community' despite being associated with the user 'asyrafhussin'. It also presents an indirect prompt injection surface by documenting patterns for ingesting untrusted data (such as transcripts and external URLs) while granting agents capabilities like file system storage and network access.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7221662. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago
Other metadata
metadata
{
  "author": "Laravel Community",
  "version": "1.0.0",
  "laravelVersion": "13.x",
  "phpVersion": "8.3+"
}

README badge

README badge for asyrafhussin/agent-skills/laravel-ai-sdk