PHPackages                             omiya0555/laravel-prism-upstage-solar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. omiya0555/laravel-prism-upstage-solar

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

omiya0555/laravel-prism-upstage-solar
=====================================

Laravel Prism provider for Upstage Solar models

v1.0.0(9mo ago)01MITPHPPHP ^8.2

Since Sep 15Pushed 9mo agoCompare

[ Source](https://github.com/omiya0555/laravel-prism-upstage-solar)[ Packagist](https://packagist.org/packages/omiya0555/laravel-prism-upstage-solar)[ RSS](/packages/omiya0555-laravel-prism-upstage-solar/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Prism Upstage Solar
===========================

[](#laravel-prism-upstage-solar)

A Laravel package that provides Upstage Solar text generation models integration with Laravel Prism.

[![Latest Version on Packagist](https://camo.githubusercontent.com/5c11531472b2a79b2778f4627fa93d9e6e198ee77af5bc78ebd7a6a0fefc87c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6d697961303535352f6c61726176656c2d707269736d2d757073746167652d736f6c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omiya0555/laravel-prism-upstage-solar)[![Total Downloads](https://camo.githubusercontent.com/f840467b4a2740e76af3b950ba6554a3d4a1affc722e09c77fb2e0f91b583a7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6d697961303535352f6c61726176656c2d707269736d2d757073746167652d736f6c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omiya0555/laravel-prism-upstage-solar)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Features
--------

[](#features)

- 🚀 **Text Generation**: Use Upstage Solar models for text generation
- 📡 **Streaming**: Real-time streaming responses
- ⚙️ **Laravel Integration**: Seamless integration with Laravel applications
- 🔧 **Auto-Discovery**: Automatic service provider discovery
- 📝 **Configurable**: Flexible configuration options

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.0, 11.0, or 12.0
- Prism PHP 0.89.0 or higher

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require omiya0555/laravel-prism-upstage-solar
```

### Publish Configuration

[](#publish-configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=config --provider="Omiya0555\LaravelPrismUpstage\PrismUpstageSolarServiceProvider"
```

This will create a `config/prism_upstage.php` file in your Laravel application.

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

Add the following environment variables to your `.env` file:

```
# Required: Your Upstage API Key
UPSTAGE_API_KEY=your_upstage_api_key_here

# Optional: Custom endpoint (default shown)
UPSTAGE_BASE_URL=https://api.upstage.ai/v1/solar

# Optional: Default model
UPSTAGE_TEXT_MODEL=solar-mini

# Optional: HTTP configuration
UPSTAGE_HTTP_TIMEOUT=30
UPSTAGE_HTTP_RETRY_ATTEMPTS=3
UPSTAGE_HTTP_RETRY_DELAY=1000
```

### Getting Your API Key

[](#getting-your-api-key)

1. Sign up at [Upstage Console](https://console.upstage.ai/)
2. Create a new API key
3. Add the API key to your `.env` file

Usage
-----

[](#usage)

### Basic Text Generation

[](#basic-text-generation)

```
use Prism\Prism\Prism;

$response = Prism::text()
    ->using('upstage', 'solar-mini')
    ->withPrompt('Explain quantum computing in simple terms.')
    ->asText();

echo $response->text;
```

### With System Prompt

[](#with-system-prompt)

```
$response = Prism::text()
    ->using('upstage', 'solar-mini')
    ->withSystemPrompt('You are a helpful assistant that responds in Japanese.')
    ->withPrompt('量子コンピュータについて簡単に説明してください。')
    ->asText();

echo $response->text;
```

### Advanced Configuration

[](#advanced-configuration)

```
$response = Prism::text()
    ->using('upstage', 'solar-mini')
    ->withPrompt('Write a creative story about AI.')
    ->withMaxTokens(500)
    ->withTemperature(0.7)
    ->withTopP(0.9)
    ->asText();

echo $response->text;
echo "Tokens used: " . $response->usage->totalTokens();
```

### Streaming Responses

[](#streaming-responses)

```
$stream = Prism::text()
    ->using('upstage', 'solar-mini')
    ->withPrompt('Tell me a story about space exploration.')
    ->asStream();

foreach ($stream as $chunk) {
    echo $chunk->text;
    flush(); // Send output to browser immediately
}
```

### Available Models

[](#available-models)

#### Text Generation Models

[](#text-generation-models)

- `solar-mini`: Fast and efficient model for general tasks
- `solar-1-mini`: Improved version with better performance
- `solar-pro`: Advanced model for complex tasks

Laravel Integration Examples
----------------------------

[](#laravel-integration-examples)

### Controller Example

[](#controller-example)

```
