Halo Semua đź‘‹, Saya Achmad Zakariya

Mahasiswa Teknik Informatika

Orang lain gak akan bisa paham struggle dan masa sulitnya kita, yang mereka ingin tahu hanya bagian success stories-nya saja. Berjuanglah untuk diri sendiri walaupun gak ada yang tepuk tangan. Kelak diri kita di masa depan akan sangat bangga dengan apa yang kita perjuangkan hari ini.

Hubungi Saya
Achmad Zakariya

Tentang Saya

Sinopsis

Seorang mahasiswa Teknik Informatika yang sangat mudah beradaptasi dengan pengalaman luas dalam pengembangan situs web dan pemrograman perangkat lunak. Saya siap menghadapi tantangan baru di dunia profesional dan berkontribusi positif pada proyek yang saya ikuti. Didorong oleh semangat yang kuat untuk mempelajari pemrograman, saya berusaha untuk secara konsisten memberikan hasil berkualitas tinggi sebagai bagian dari tim atau mandiri.

Mari Berteman

Hai! Saya senang Anda berkunjung ke web pribadi saya. Ayo berkenalan dan bagikan ide, inspirasi, atau cerita Anda. Mari membangun hubungan yang positif dan saling mendukung. Saya sangat menghargai teman-teman baru, jadi mari berhubungan dan saling berbagi dalam perjalanan hidup ini. Mari tetap terhubung, saling bertukar pendapat, dan Jangan sungkan untuk meninggalkan jejak atau mengirim pesan.

Portofolio

Project Terbaru

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iure adipisci labore natus voluptatum dolores? Itaque hic natus accusantium iusto pariatur voluptatum, provident consequuntur. Fugit, consectetur. Commodi ullam incidunt atque repellendus.

Amora ERP System

Amora ERP System

Software Development with experience in Enterprise Resource Planning (ERP) application development, backend engineering, and managing corporate digital infrastructure. Skilled in building applications using Laravel, React.js, MySQL, and knowledgeable in the implementation of Docker, Git, and CI/CD concepts into NAS Storage Configuration.

Cogic Space Company Profile

Cogic Space Company Profile

This project is a Company Profile Cogic Space. The system helps digital transformation bussiness solutions. It is designed to support a more services, transparent, and efficient selection process for social assistance distribution.

Riyung ERP System

Riyung ERP System

Digital Infrastructure Developer with experience in Enterprise Resource Planning (ERP) application development, backend engineering, and managing corporate digital infrastructure. Skilled in building applications using Golang, React.js, and REST APIs, and knowledgeable in the implementation of Docker, Git, and CI/CD concepts.

Management System of the Innovation Comprehensive Credit Union

Management System of the Innovation Comprehensive Credit Union

This project is a management system developed for the Innovation Comprehensive Credit Union. The system helps manage member data, financial transactions, savings, and loan processes in a more organized and efficient way. The goal of this project is to improve operational management, data accuracy, and service quality within the credit union.

Management System Designed To Handle Tree Menu Features

Management System Designed To Handle Tree Menu Features

This project is a management system designed to handle tree menu features within an admin panel. The system helps administrators organize, manage, and control hierarchical menu structures more efficiently through an interactive interface. The goal of this project is to simplify menu management, improve navigation structure, and enhance admin panel usability.

Datanode Company Profile Management System

Datanode Company Profile Management System

This project is a company profile website for Datanode. The website shows information about the company, services, and portfolio. It helps clients and partners to know more about Datanode and contact the company easily. The goal of this project is to make Datanode look professional and trusted online.

Booking Online Healthcare Mobile Version System

Booking Online Healthcare Mobile Version System

This project is a mobile online booking system designed for patients. The system allows patients to book appointments, manage schedules, and access healthcare services more easily through a mobile application. The goal of this project is to improve convenience, reduce waiting time, and simplify the healthcare booking process.

Web Based Streaming Platform For Movies And TV Shows

Web Based Streaming Platform For Movies And TV Shows

The system allows users to browse, search, and watch movies through a modern and user-friendly interface. The goal of this project is to provide an enjoyable streaming experience with organized content management and seamless video playback.

Teman Tukang Bisnis Company Profile Information System

Teman Tukang Bisnis Company Profile Information System

This project is a UI/UX Design Web for Teman Tukang operational management and company profile. This system helps customers simplify ordering Teman Tukang services, manage Teman Tukang business operations, and manage company profile website content.

Redsign Front End User Interface Product Management System

Redsign Front End User Interface Product Management System

This project is a product management system. This website uses custom user interface (UI) components created with Laravel as the framework and TailwindCSS for styling with JavaScript to make the website more interactive. This project aims to make it easier for users to manage products by implementing a modern and user-friendly user interface (UI).

Mobile User Interface Song Management System

Mobile User Interface Song Management System

This project is a mobile-based song management system. This application uses material widget user interface (UI) components available on Flutter as a framework. This project aims to make it easier for users to manage songs by implementing a user-friendly user interface (UI).

Virtual Reality and Augmented Reality in Post-Stroke Rehabilitation Bikes

Virtual Reality and Augmented Reality in Post-Stroke Rehabilitation Bikes

This project is a Virtual Reality and Augmented Reality system designed for post-stroke cycling therapy. The system helps patients perform rehabilitation exercises in a more interactive and engaging way by combining cycling therapy with immersive VR and AR technology. The goal of this project is to support patient recovery, improve motivation during therapy, and enhance the rehabilitation experience.

Management System of the Mitra Mandiri Credit Union

Management System of the Mitra Mandiri Credit Union

This project is a website system for Koperasi Simpan Pinjam Mitra Mandiri. The website helps members to manage savings and loans easily. It shows information about loan applications, payment status, member data and more. The goal of this project is to make the cooperative management process more simple, transparent, and efficient.

Management Information System: Books Published by Polije Press

Management Information System: Books Published by Polije Press

This project is a website system for Polije Press. The website shows books, journals, and publications from Polije. It helps readers to find information, order books, and contact the publisher. The goal of this project is to support academic publishing and make it easier to access publications online.

ITS Surabaya Chemistry Department E-Skripsi Information System

ITS Surabaya Chemistry Department E-Skripsi Information System

This project is a website system for E-Skripsi Chemistry ITS Surabaya. This website helps students choose their thesis supervisors. This website also helps lecturers review and approve theses more easily. The goal of this project is to make the thesis process faster and simpler.

Information System for Duck Farming Analysis at Jember State Polytechnic

Information System for Duck Farming Analysis at Jember State Polytechnic

This project is a website system for SI ITIK Polije. The website helps to manage information about duck farming, including data, reports, and management activities. The goal of this project is to support farmers and students by making duck farming management easier and more modern.

Management System of the Bangun Karya Desa Credit Union

Management System of the Bangun Karya Desa Credit Union

This project is a website system for Koperasi Simpan Pinjam Bangun Karya Desa. The website helps members to manage savings and loans easily. It shows information about loan applications, payment status, member data and more. The goal of this project is to make the cooperative management process more simple, transparent, and efficient.

Mobile Legends Hero Selection Decision Support System

Mobile Legends Hero Selection Decision Support System

This project is a decision support system for choosing Mobile Legends heroes. The system helps players to select the best hero based on criteria like role, strength, and team needs. The goal of this project is to support players in making better choices and improve gameplay strategy.

Chemical Laboratory Analysis at ITS Surabaya

Chemical Laboratory Analysis at ITS Surabaya

This project is a website system for Chemical Laboratory Analysis at ITS Surabaya. The website helps students and lecturers to manage laboratory schedules, analysis requests, and results. The goal of this project is to make the lab management process more simple, clear, and efficient.

Admin Panel Web Hosting Redesign User Interface

Admin Panel Web Hosting Redesign User Interface

This project is a personal profile website. This website uses custom UI components using HTML, TailwindCSS, and JavaScript. This project aims to implement a modern and user-friendly UI for web hosting service users.

Reserved Raminten Resto System

Reserved Raminten Resto System

This project is a restaurant reservation website for Raminten. The website displays information about the restaurant's history, services, and a gallery of its ambiance. It helps clients and partners learn more about Raminten and easily make table reservations and orders.

Shoe Cleaning Service Order Management Information System

Shoe Cleaning Service Order Management Information System

This project is a website system for Tosepatu, a shoe care service. The website helps customers to order shoe cleaning services online. It also shows service prices, packages, and contact information. The goal of this project is to make it easier for customers to take care of their shoes in a simple and modern way.

Customer Relationship Management System

Customer Relationship Management System

This project is a Customer Relationship Management System. This website uses custom UI components using HTML, TailwindCSS, and JavaScript. This project aims to implement a modern and user-friendly UI for web hosting service users.

Sistem Pendukung Keputusan Dosen Pembimbing Skripsi D4 - Teknik Informatika Menggunakan Metode Profile Matching

Sistem Pendukung Keputusan Dosen Pembimbing Skripsi D4 - Teknik Informatika Menggunakan Metode Profile Matching

This project is a decision support system for choosing thesis supervisors. The system helps students to select the right lecturer based on criteria such as expertise, quota, and experience. The goal of this project is to make the supervisor selection process easier, fair, and more efficient

Kusuma Hospital Online Booking Content Management System

Kusuma Hospital Online Booking Content Management System

The RSU Kusuma Hospital Online Booking System is a web-based application designed to make it easier for patients to register and schedule outpatient clinic appointments online without having to visit the hospital in person. This application helps the hospital reduce lines at the registration desk, improve service efficiency, and provide a more convenient experience for patients.

Klien

Yang Pernah Bekerjasama

Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iure adipisci labore natus voluptatum dolores? Itaque hic natus accusantium iusto pariatur voluptatum, provident consequuntur. Fugit, consectetur. Commodi ullam incidunt atque repellendus.

Blog

Tulisan Terkini

Selamat datang di blog saya, tempat di mana saya berbagi pandangan, pengetahuan, dan pengalaman. Jelajahi tulisan-tulisan terbaru yang mencakup berbagai topik, mulai dari teknologi, kreativitas, hingga panduan praktis. Saya berharap blog ini dapat menjadi sumber inspirasi dan wawasan bagi Anda.

Beyond the Graph: How MLIR and XLA Are Redefining TensorFlow Performance

Beyond the Graph: How MLIR and XLA Are Redefining TensorFlow Performance

# Beyond the Graph: Mastering the MLIR-Driven Evolution of TensorFlow and XLA Machine learning used to be a zero-sum game between speed and developer experience. You either chose the flexibility of Eager execution—great for debugging, but sluggish in production—or you locked yourself into the rigid, complex world of static graphs. The modern TensorFlow ecosystem has effectively killed that trade-off. By moving toward an **MLIR-based (Multi-Level Intermediate Representation)** compiler infrastructure and leaning heavily on **XLA (Accelerated Linear Algebra)**, TensorFlow has transitioned from a simple library of operations into a sophisticated, optimizing compiler. This isn't just an internal refactor. It’s a fundamental shift in how we architect models, handle distributed state, and deploy to specialized hardware. ## The Architectural Shift: From Op-by-Op to MLIR Dialects In the old days, TensorFlow treated every operation—like a Matrix Multiplication or a Convolution—as a discrete unit. The execution engine would launch these ops one by one. This created massive overhead, especially on GPUs where the cost of launching kernels and moving data often outweighed the actual computation. Under the hood, TensorFlow now uses MLIR to bridge the gap between high-level Python and machine code. Think of MLIR as a translation layer that uses **dialects** to optimize code at the right level of abstraction: 1. **TensorFlow Dialect:** Handles high-level TF operations. 2. **Linalg Dialect:** Where the magic happens for linear algebra, allowing for loop transformations and tiling. 3. **LLVM Dialect:** The final step, lowering code for specific CPUs or GPUs. ### Kernel Fusion via XLA XLA is the engine that consumes these representations. Its most effective trick is **kernel fusion**. Instead of launching three separate kernels for an activation like `ReLU(Add(Bias, MatMul))`, XLA fuses them into a single GPU kernel. This keeps intermediate results in fast, on-chip registers rather than flushing them back to VRAM—essentially bypassing the "memory wall." ```python import tensorflow as tf # Force XLA compilation for a performance-critical block @tf.function(jit_compile=True) def optimized_block(x, w, b): # XLA will fuse the MatMul, Add, and GeLU into a single kernel launch res = tf.matmul(x, w) + b return tf.nn.gelu(res) # Realistic benchmark setup x = tf.random.normal((1024, 1024)) w = tf.random.normal((1024, 1024)) b = tf.random.normal((1024,)) # The first call triggers the MLIR lowering and XLA compilation output = optimized_block(x, w, b) ``` ## Keras 3: The Multi-Backend Reality The release of **Keras 3** is a massive win for engineering flexibility. By decoupling the API from the TensorFlow runtime, Keras now acts as a high-level frontend for TensorFlow, JAX, and PyTorch. The kicker? You can write a vision transformer once and toggle the backend via an environment variable. This removes the technical debt of rewriting models when you want to move from a research-heavy JAX environment to a production-hardened TensorFlow Serving pipeline. ### Mixed Precision and Compute Trade-offs Modern accelerators like H100s or TPUs are built for `float16` or `bfloat16`. Keras 3 treats **Automatic Mixed Precision (AMP)** as a first-class citizen. It manages the loss scaling needed to prevent numerical underflow while effectively doubling your throughput. ```python import keras # Global policy for mixed precision keras.mixed_precision.set_global_policy("mixed_float16") model = keras.Sequential([ keras.layers.Dense(2048, activation="relu", input_shape=(1024,)), keras.layers.Dense(1024, activation="relu"), # Output layer uses float32 for numerical stability in softmax/loss keras.layers.Dense(10, activation="softmax", dtype="float32") ]) # Compilation automatically leverages XLA if the backend supports it model.compile(optimizer="adam", loss="sparse_categorical_crossentropy") ``` ## TFRT and the Pluggable Device API The original TensorFlow runtime was a monolithic C++ engine that was notoriously difficult to extend. The introduction of **TFRT (TensorFlow Runtime)** and the **Pluggable Device API** has changed that. * **TFRT:** This is an asynchronous, lock-free task executor. It slashes host-side CPU latency by overlapping op scheduling with device execution. * **Pluggable Device API:** Hardware vendors (Intel for OneDNN, Apple for Metal, AMD for ROCm) no longer have to fork TensorFlow. They build a shared library that plugs into the core. For us, this means "out of the box" acceleration on a MacBook M3 or an Intel Gaudi chip without touching a line of code. ## Scaling: The DTensor Evolution Distributed training used to rely on `Strategy` objects that often felt like an afterthought. **DTensor** is the modern answer for multi-device training, treating a cluster of devices as a single virtual device. Instead of manual data sharding, you define a **Mesh** (a logical grid of devices) and a **Layout** (how tensors are distributed across that grid). | Feature | Legacy MirroredStrategy | DTensor (New) | | :--- | :--- | :--- | | **Model Parallelism** | Difficult / Manual | Native (Sharding across Mesh) | | **Programming Model** | Wrapper-based | Tensor-based (Global View) | | **Complexity** | High for custom setups | Low (Declarative Layouts) | ### Distributed Layout Example ```python from tensorflow.experimental import dtensor # Define a 2x4 mesh (8 GPUs total) mesh = dtensor.create_mesh([("batch", 2), ("model", 4)], devices=device_list) # Shard the weight matrix across the 'model' dimension layout = dtensor.Layout(["batch", "model"], mesh) # DTensor handles the collective communication (AllReduce/AllGather) automatically weights = dtensor.DVariable( initial_value=tf.random.normal([1024, 4096]), layout=dtensor.Layout.replicated(mesh, rank=2) ) ``` ## Solving Real-World Friction ### 1. Unified TFLite and Serving The gap between mobile (TFLite) and server (TF Serving) has historically been a headache. By using MLIR as the common language, the path from a Keras model to a `.tflite` flatbuffer is significantly cleaner. The compiler handles constant folding and dead code elimination at the MLIR level, so your mobile binary isn't bloated with training-only operations. ### 2. No More Manual Kernel Tuning Before XLA, custom ops often required hand-written CUDA kernels to be performant. Now, if you express your op using standard TF primitives within a `jit_compile=True` function, the compiler handles loop unrolling and register allocation for you. ### 3. Ending Data Starvation TFRT’s asynchronous execution helps solve the "data starvation" problem, where a powerful GPU sits idle waiting for the CPU to pre-process the next batch. When paired with `tf.data` pipelines, you get much closer to linear scaling across multiple nodes. ## Implementation Strategy To make the most of this stack, stop thinking about "building a graph" and start thinking about "data flow." * **Stick to the Keras 3 Functional API** to keep your backend options open. * **Apply `jit_compile=True`** specifically to heavy compute blocks to trigger XLA. * **Adopt Mixed Precision** early to save memory and increase batch sizes. * **Look at DTensor** for any project that scales beyond a single node or requires model sharding. The evolution of TensorFlow toward a compiler-centric model effectively removes the "performance tax" of high-level libraries. The infrastructure finally understands the model’s intent, allowing us to focus on architecture while the MLIR stack handles the micro-optimizations on the silicon.

Baca Selengkapnya
Beyond RAG: How Context Caching in Gemini 1.5 Flash Slashes AI Costs by 90%

Beyond RAG: How Context Caching in Gemini 1.5 Flash Slashes AI Costs by 90%

# Beyond RAG: Rethinking LLM Economics with Gemini 1.5 Flash and Context Caching Building context-aware applications has always felt like a series of compromises. If you wanted an AI agent to understand your entire Laravel codebase or a 500-page technical manual, you had two choices: pay an exorbitant "token tax" by re-sending the entire context with every request, or build a complex Retrieval-Augmented Generation (RAG) pipeline. RAG was a clever workaround, but it introduced its own set of headaches—vector database management, chunking strategies, and the inevitable "loss in the middle" during retrieval. With the release of **Gemini 1.5 Flash** and its native **Context Caching API**, the math has changed. We are moving away from fragile retrieval systems toward a "Long-Context" architecture where we can persist up to 1 million tokens directly in the model's memory. ## The Problem: The Prefill Bottleneck In standard transformer architectures, every time you send a prompt, the model has to process the entire input from scratch. This is called the "prefill" stage. If you’re building a Laravel helper that analyzes your `app/` directory, and that directory contains 100,000 tokens of code, you are paying for those 100,000 tokens every single time you ask a question. For serverless developers using AWS Lambda or Laravel Vapor, this isn't just a cost issue—it's a performance killer. Processing massive prefixes leads to high TTFT (Time to First Token), often pushing execution times toward the 30-second timeout limit. ## The Solution: Context Caching Gemini 1.5 Flash introduces a distilled, high-throughput architecture that allows us to store the **Key-Value (KV) cache** of a prompt prefix. Instead of re-calculating the mathematical representation of your codebase for every request, the model "saves" the state of that prefix for a specified Time-to-Live (TTL). When you make a subsequent call, the model skips the prefill stage for the cached portion and jumps straight to generating the answer. ### Why this matters for the Laravel Ecosystem: 1. **Cost Reduction:** You pay a small one-time fee to cache the context and then a significantly reduced rate for hits against that cache. 2. **Latency:** Responses that used to take 20 seconds of "thinking" now start streaming almost instantly. 3. **Simplicity:** No more Pinecone, no more embeddings, no more complicated chunking logic. Just feed the whole repo into the cache. --- ## Implementing Context Caching in Laravel Let’s look at how we can implement this in a real-world Laravel scenario. Imagine we want to build an Artisan command that audits our entire application for security vulnerabilities. First, we define our "Context" (the codebase) and cache it via the Google AI API. ```php namespace App\Services; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\File; class GeminiCacheService { protected string $baseUrl = 'https://generativelanguage.googleapis.com/v1beta'; public function createCodebaseCache(string $displayName): string { // Gather all relevant PHP files $files = File::allFiles(app_path()); $codeContent = ""; foreach ($files as $file) { $codeContent .= "\n--- File: " . $file->getRelativePathname() . " ---\n"; $codeContent .= $file->getContents(); } // Create the cache via the API $response = Http::withHeaders([ 'x-goog-api-key' => config('services.gemini.key'), 'Content-Type' => 'application/json', ])->post("{$this->baseUrl}/cachedContents", [ 'model' => 'models/gemini-1.5-flash-001', 'display_name' => $displayName, 'contents' => [ ['role' => 'user', 'parts' => [['text' => $codeContent]]] ], 'ttl' => '3600s', // Keep the codebase in memory for 1 hour ]); return $response->json('name'); // Returns the cache ID } } ``` Once the codebase is cached, our subsequent calls to analyze specific features or bugs become incredibly lightweight. We simply reference the `cached_content` ID in our request. ```php public function analyzeFeature(string $cacheName, string $userPrompt) { $response = Http::withHeaders([ 'x-goog-api-key' => config('services.gemini.key'), ])->post("{$this->baseUrl}/models/gemini-1.5-flash-001:generateContent", [ 'contents' => [ ['role' => 'user', 'parts' => [['text' => $userPrompt]]] ], 'cached_content' => $cacheName, // This is where the magic happens ]); return $response->json('candidates.0.content.parts.0.text'); } ``` --- ## The Economic Shift The cost implications here are staggering. For a codebase or dataset totaling 500,000 tokens, the traditional approach vs. the cached approach looks like this: | Metric | Traditional (Long-Context) | Context Caching (Gemini 1.5 Flash) | | :--- | :--- | :--- | | **Prefill Cost (per 1k tokens)** | ~$0.0003 | ~$0.000075 (after cache hit) | | **TTFT (Latency)** | 10–30 seconds | < 2 seconds | | **Architectural Overhead** | Low | Low | | **Data Freshness** | Instant | Requires Cache Refresh | By moving the heavy lifting to the cache, we effectively see a **90% reduction in per-request token costs** for repetitive tasks. ## Beyond RAG: The "Permanent Memory" Architecture This technology encourages a fundamental shift in how we build AI-integrated software. Instead of thinking of LLMs as stateless functions, we can start treating them as stateful collaborators. ### Use Case: The Agentic Workspace In a Laravel environment, you could have a background job that refreshes a "System State" cache every time you deploy. This cache would include your `routes/web.php`, your database schema, and your core service classes. Whenever a developer runs a command like `php artisan ai:refactor {controller}`, the model already "knows" the context of the entire app. It knows that your `OrderService` relies on a specific `StripeClient` and that your database uses UUIDs instead of increments. It has a "permanent" memory of your workspace structure. ### Trade-offs to Consider While Context Caching is powerful, it isn't a silver bullet. - **The TTL Window:** Caches have a Time-to-Live. If your agent is only used once every six hours, the cost of "priming" the cache might outweigh the benefits. - **Model Distillation:** Gemini 1.5 Flash is highly capable, but it is a distilled version of 1.5 Pro. For complex, multi-step logical reasoning across 1M tokens, you may still need to benchmark against 1.5 Pro to ensure no degradation in output quality. ## Final Thoughts The "Flash" in Gemini 1.5 Flash isn't just about speed—it's about the democratization of long-context intelligence. For the first time, we can provide LLMs with a deep, holistic understanding of our entire application without breaking the bank or waiting for 30-second response cycles. As we move toward more agentic workflows, the ability to bypass the prefill stage and treat massive datasets as a "hot" cache will become the standard for high-performance AI integrations. It's time to stop chunking and start caching.

Baca Selengkapnya
Laravel 13: Why AI is the New First-Class Citizen in Web Frameworks

Laravel 13: Why AI is the New First-Class Citizen in Web Frameworks

# Laravel 13: AI is Now a Core Primitive For years, integrating Large Language Models (LLMs) into Laravel applications felt like building a bridge with duct tape. We’ve relied on a fragmented ecosystem of community packages, manual JSON schema definitions for tool calling, and the constant overhead of keeping vector databases in sync with our Eloquent models. With the release of Laravel 13, the framework officially moves beyond "supporting" AI to treating it as a first-class citizen. By introducing native AI orchestration, standardized Model Context Protocol (MCP) support, and driver-based vector indexing, Laravel 13 transforms the LLM from an external black box into a standard piece of infrastructure—right alongside your database and cache. ## The AI Facade: Multi-Model Orchestration The most visible change is the new `AI` Facade. Much like the `Storage` or `Mail` components, it abstracts the underlying provider (OpenAI, Anthropic, Gemini, or local Ollama instances) behind a unified API. The real power here isn't just switching providers with a config change; it's the built-in support for fallback logic and multi-model routing. ```php use Illuminate\Support\Facades\AI; // Simple chat completion with a fallback $response = AI::withFallback(['anthropic', 'gemini']) ->prompt('Analyze this server log for anomalies.') ->withContext(['logs' => $logData]) ->generate(); echo $response->content(); ``` Under the hood, Laravel handles the varying API structures, retry logic, and token usage tracking. This removes the boilerplate associated with vendor lock-in and allows us to use the best model for the specific task at hand. ## Eloquent meets Vector Search Historically, keeping a vector index (like Pinecone or Milvus) synchronized with your SQL database was a recipe for race conditions and data drift. Laravel 13 solves this by introducing native Vector Indexing middleware for Eloquent. By adding a simple interface to your model, Laravel automatically handles the embedding generation and synchronization whenever a record is created or updated. ```php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\AI\Vector\Searchable; class Documentation extends Model implements Searchable { // Laravel automatically triggers the embedding driver on save public function toVectorArray(): array { return [ 'id' => $this->id, 'content' => $this->body, 'metadata' => [ 'category' => $this->category, ], ]; } } ``` Now, searching your data using semantic meaning is as "Laravel-native" as a standard query: ```php $docs = Documentation::vectorSearch('How do I configure Redis?') ->where('category', 'infrastructure') ->limit(5) ->get(); ``` ## Bridging the Gap with MCP One of the most significant architectural additions is the native implementation of the **Model Context Protocol (MCP)**. MCP allows your Laravel application to act as a standardized context source for AI clients (like Claude Desktop or Cursor). Instead of building bespoke APIs for AI agents, you can expose your application's data and logic via an MCP server. This allows an AI agent to "browse" your application's internal state or trigger business logic securely. ```php // routes/mcp.php use Illuminate\Support\Facades\MCP; MCP::tool('get_user_billing', function (int $userId) { return User::findOrFail($userId)->billingHistory; })->description('Fetch the recent billing history for a specific user ID.'); ``` This effectively turns your Laravel app into a "plugin" for the next generation of AI-powered IDEs and agents, bridging the gap between private data silos and the LLM. ## Tool Calling: Logic, Not Just Strings The "Agentic" workflow—where an LLM decides to execute code—has always been high-friction. You typically had to manually define JSON schemas for every function and then map the LLM’s response back to a controller method. Laravel 13 streamlines this by allowing you to pass classes directly to the AI Facade as tools. The framework uses reflection to generate the schema and handles the execution automatically. ```php use App\AI\Tools\WeatherService; $result = AI::withTools([WeatherService::class]) ->prompt('Should I wear a coat in London today?') ->execute(); // Laravel handles the schema generation, // the LLM requests the 'getWeather' function, // Laravel executes it and returns the final natural language answer. ``` ## Why This Matters: From Prompts to Context The industry is moving away from complex prompt engineering toward **Context Engineering**. The bottleneck is no longer how you phrase a question, but how efficiently you can feed the LLM relevant, real-time data from your application. By integrating AI orchestration into the framework, Laravel 13 provides several key advantages: | Feature | Old Way | Laravel 13 Way | | :--- | :--- | :--- | | **Provider Logic** | Bespoke SDK integrations | Driver-based AI Facade | | **Data Sync** | Manual observers + external APIs | Native Eloquent Vector Indexing | | **Tool Calling** | Manual JSON schema boilerplate | Reflection-based class mapping | | **Agent Access** | Custom API endpoints | Standardized MCP Server | ## The Architectural Shift We are moving toward a world where LLMs are treated as another utility, similar to how we treat a Queue worker or a Mailer. We don't care *how* the email is sent, just that the interface is reliable. Laravel 13 allows builders to focus on the business logic—the "Tools" and the "Context"—rather than the plumbing of AI integration. It reduces dependency bloat, lowers maintenance costs, and ensures that as the AI landscape shifts (and new models emerge), our applications remain decoupled and performant. If you've been hesitating to build "Agentic" features due to the complexity of the stack, Laravel 13 just removed the barrier to entry. The focus is no longer on how to talk to the AI, but on what your application can empower the AI to do.

Baca Selengkapnya