Skip to content

Commit 889a677

Browse files
authored
Reorg to prism-php (#243)
1 parent 143e6e5 commit 889a677

File tree

239 files changed

+1370
-1367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+1370
-1367
lines changed

.github/workflows/tests.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest]
1818
php: [8.3, 8.4]
19-
laravel: [11.*]
19+
laravel: [11.*, 12.*]
2020
stability: [prefer-lowest, prefer-stable]
2121
include:
2222
- laravel: 11.*
2323
testbench: 9.*
2424
carbon: ^2.63
25+
- laravel: 12.*
26+
testbench: 10.*
27+
carbon: ^3.8.4
2528

2629
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2730

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
![](assets/prism-banner.webp)
22

33
<p align="center">
4-
<a href="https://packagist.org/packages/echolabsdev/prism">
5-
<img src="https://poser.pugx.org/echolabsdev/prism/d/total.svg" alt="Total Downloads">
4+
<a href="https://packagist.org/packages/prism-php/prism">
5+
<img src="https://poser.pugx.org/prism-php/prism/d/total.svg" alt="Total Downloads">
66
</a>
7-
<a href="https://packagist.org/packages/echolabsdev/prism">
8-
<img src="https://poser.pugx.org/echolabsdev/prism/v/stable.svg" alt="Latest Stable Version">
7+
<a href="https://packagist.org/packages/prism-php/prism">
8+
<img src="https://poser.pugx.org/prism-php/prism/v/stable.svg" alt="Latest Stable Version">
99
</a>
10-
<a href="https://packagist.org/packages/echolabsdev/prism">
11-
<img src="https://poser.pugx.org/echolabsdev/prism/license.svg" alt="License">
10+
<a href="https://packagist.org/packages/prism-php/prism">
11+
<img src="https://poser.pugx.org/prism-php/prism/license.svg" alt="License">
1212
</a>
1313
</p>
1414

@@ -18,15 +18,15 @@ Prism is a powerful Laravel package for integrating Large Language Models (LLMs)
1818

1919
## Official Documentation
2020

21-
Official documentation can be found on the [Prism website](https://prism.echolabs.dev).
21+
Official documentation can be found on the [Prism website](https://prismphp.com).
2222

2323
## Code of Conduct
2424

2525
While we aren't affiliated with Laravel, we follow the Laravel [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). We expect you to abide by these guidelines as well.
2626

2727
## Authors
2828

29-
This library is created by [TJ Miller](https://tjmiller.me) with contributions from the [Open Source Community](https://github.com/echolabsdev/prism/graphs/contributors).
29+
This library is created by [TJ Miller](https://tjmiller.me) with contributions from the [Open Source Community](https://github.com/prismphp/prism/graphs/contributors).
3030

3131
## License
3232

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "echolabsdev/prism",
2+
"name": "prism-php/prism",
33
"description": "A powerful Laravel package for integrating Large Language Models (LLMs) into your applications.",
44
"type": "library",
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {
8-
"EchoLabs\\Prism\\": "src/"
8+
"PrismPHP\\Prism\\": "src/"
99
}
1010
},
1111
"authors": [
@@ -86,10 +86,10 @@
8686
"extra": {
8787
"laravel": {
8888
"providers": [
89-
"EchoLabs\\Prism\\PrismServiceProvider"
89+
"PrismPHP\\Prism\\PrismServiceProvider"
9090
],
9191
"aliases": {
92-
"PrismServer": "EchoLabs\\Prism\\Facades\\PrismServer"
92+
"PrismServer": "PrismPHP\\Prism\\Facades\\PrismServer"
9393
}
9494
}
9595
}

docs/advanced/custom-providers.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ Want to add support for a new AI provider in Prism? This guide will walk you thr
44

55
## Provider Interface
66

7-
All providers must implement the `EchoLabs\Prism\Contracts\Provider` interface:
7+
All providers must implement the `PrismPHP\Prism\Contracts\Provider` interface:
88

99
```php
10-
use EchoLabs\Prism\Embeddings\Request as EmbeddingsRequest;
11-
use EchoLabs\Prism\Embeddings\Response as EmbeddingsResponse;
12-
use EchoLabs\Prism\Structured\Request as StructuredRequest;
13-
use EchoLabs\Prism\Structured\Response as StructuredResponse;
14-
use EchoLabs\Prism\Text\Request as TextRequest;
15-
use EchoLabs\Prism\Text\Response as TextResponse;
10+
use PrismPHP\Prism\Embeddings\Request as EmbeddingsRequest;
11+
use PrismPHP\Prism\Embeddings\Response as EmbeddingsResponse;
12+
use PrismPHP\Prism\Structured\Request as StructuredRequest;
13+
use PrismPHP\Prism\Structured\Response as StructuredResponse;
14+
use PrismPHP\Prism\Text\Request as TextRequest;
15+
use PrismPHP\Prism\Text\Response as TextResponse;
1616

1717
interface Provider
1818
{
@@ -65,7 +65,7 @@ return [
6565
Now you can use your custom provider:
6666

6767
```php
68-
use EchoLabs\Prism\Facades\Prism;
68+
use PrismPHP\Prism\Facades\Prism;
6969

7070
$response = Prism::text()
7171
->using('my-custom-provider', 'model-name')

docs/advanced/rate-limits.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Prism throws a `PrismRateLimitedException` when you hit a rate limit.
3131
You can catch that exception, gracefully fail and inspect the `rateLimits` property which contains an array of `ProviderRateLimit`s.
3232

3333
```php
34-
use EchoLabs\Prism\Prism;
35-
use EchoLabs\Enums\Provider;
36-
use EchoLabs\Prism\ValueObjects\ProviderRateLimit;
37-
use EchoLabs\Prism\Exceptions\PrismRateLimitedException;
34+
use PrismPHP\Prism\Prism;
35+
use PrismPHP\Enums\Provider;
36+
use PrismPHP\Prism\ValueObjects\ProviderRateLimit;
37+
use PrismPHP\Prism\Exceptions\PrismRateLimitedException;
3838

3939
try {
4040
Prism::text()
@@ -61,7 +61,7 @@ However most providers implement various rate limits (e.g. request, input tokens
6161
For simple rate limits like "requests", the `remaining` property on `ProviderRateLimit` will be 0 if you have hit it. These are easy to find:
6262

6363
```php
64-
use EchoLabs\Prism\ValueObjects\ProviderRateLimit;
64+
use PrismPHP\Prism\ValueObjects\ProviderRateLimit;
6565
use Illuminate\Support\Arr;
6666

6767
try {
@@ -77,7 +77,7 @@ For less simple rate limits like input tokens, the `remaining` property may not
7777
Here, you may need to implement some logic to approximate how many tokens your request will use before sending it, and then test against that:
7878

7979
```php
80-
use EchoLabs\Prism\ValueObjects\ProviderRateLimit;
80+
use PrismPHP\Prism\ValueObjects\ProviderRateLimit;
8181
use Illuminate\Support\Arr;
8282

8383
try {
@@ -105,9 +105,9 @@ If you aren't sure where to start with that, check out the [What should you do w
105105
Prism adds the same rate limit information to every successful request:
106106

107107
```php
108-
use EchoLabs\Prism\Prism;
109-
use EchoLabs\Enums\Provider;
110-
use EchoLabs\Prism\ValueObjects\ProviderRateLimit;
108+
use PrismPHP\Prism\Prism;
109+
use PrismPHP\Enums\Provider;
110+
use PrismPHP\Prism\ValueObjects\ProviderRateLimit;
111111

112112
$response = Prism::text()
113113
->using(Provider::Anthropic, 'claude-3-5-sonnet-20241022')

docs/core-concepts/embeddings.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Transform your text into powerful vector representations! Embeddings let you add
77
Here's how to generate an embedding with just a few lines of code:
88

99
```php
10-
use EchoLabs\Prism\Prism;
11-
use EchoLabs\Prism\Enums\Provider;
10+
use PrismPHP\Prism\Prism;
11+
use PrismPHP\Prism\Enums\Provider;
1212

1313
$response = Prism::embeddings()
1414
->using(Provider::OpenAI, 'text-embedding-3-large')
@@ -27,8 +27,8 @@ echo $response->usage->tokens;
2727
You can generate multiple embeddings at once with all providers that support embeddings, other than Gemini:
2828

2929
```php
30-
use EchoLabs\Prism\Prism;
31-
use EchoLabs\Prism\Enums\Provider;
30+
use PrismPHP\Prism\Prism;
31+
use PrismPHP\Prism\Enums\Provider;
3232

3333
$response = Prism::embeddings()
3434
->using(Provider::OpenAI, 'text-embedding-3-large')
@@ -60,8 +60,8 @@ You've got two convenient ways to feed text into the embeddings generator:
6060
### Direct Text Input
6161

6262
```php
63-
use EchoLabs\Prism\Prism;
64-
use EchoLabs\Prism\Enums\Provider;
63+
use PrismPHP\Prism\Prism;
64+
use PrismPHP\Prism\Enums\Provider;
6565

6666
$response = Prism::embeddings()
6767
->using(Provider::OpenAI, 'text-embedding-3-large')
@@ -74,8 +74,8 @@ $response = Prism::embeddings()
7474
Need to analyze a larger document? No problem:
7575

7676
```php
77-
use EchoLabs\Prism\Prism;
78-
use EchoLabs\Prism\Enums\Provider;
77+
use PrismPHP\Prism\Prism;
78+
use PrismPHP\Prism\Enums\Provider;
7979

8080
$response = Prism::embeddings()
8181
->using(Provider::OpenAI, 'text-embedding-3-large')
@@ -91,8 +91,8 @@ $response = Prism::embeddings()
9191
Just like with text generation, you can fine-tune your embeddings requests:
9292

9393
```php
94-
use EchoLabs\Prism\Prism;
95-
use EchoLabs\Prism\Enums\Provider;
94+
use PrismPHP\Prism\Prism;
95+
use PrismPHP\Prism\Enums\Provider;
9696

9797
$response = Prism::embeddings()
9898
->using(Provider::OpenAI, 'text-embedding-3-large')
@@ -107,7 +107,7 @@ $response = Prism::embeddings()
107107
The embeddings response gives you everything you need:
108108

109109
```php
110-
namespace EchoLabs\Prism\ValueObjects\Embedding;
110+
namespace PrismPHP\Prism\ValueObjects\Embedding;
111111

112112
// Get an array of Embedding value objects
113113
$embeddings = $response->embeddings;
@@ -130,9 +130,9 @@ $tokenCount = $response->usage->tokens;
130130
Always handle potential errors gracefully:
131131

132132
```php
133-
use EchoLabs\Prism\Prism;
134-
use EchoLabs\Prism\Enums\Provider;
135-
use EchoLabs\Prism\Exceptions\PrismException;
133+
use PrismPHP\Prism\Prism;
134+
use PrismPHP\Prism\Enums\Provider;
135+
use PrismPHP\Prism\Exceptions\PrismException;
136136

137137
try {
138138
$response = Prism::embeddings()

docs/core-concepts/prism-server.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ First, make sure Prism Server is enabled in your `config/prism.php` file:
2525
To make your Prism models available through the server, you need to register them. This is typically done in a service provider, such as `AppServiceProvider`:
2626

2727
```php
28-
use EchoLabs\Prism\Prism;
29-
use EchoLabs\Prism\Enums\Provider;
30-
use EchoLabs\Prism\Facades\PrismServer;
28+
use PrismPHP\Prism\Prism;
29+
use PrismPHP\Prism\Enums\Provider;
30+
use PrismPHP\Prism\Facades\PrismServer;
3131
use Illuminate\Support\ServiceProvider;
3232

3333
class AppServiceProvider extends ServiceProvider

docs/core-concepts/schemas.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Schemas are the blueprints that help you define the shape of your data in Prism.
77
Let's dive right in with a practical example:
88

99
```php
10-
use EchoLabs\Prism\Schema\ArraySchema;
11-
use EchoLabs\Prism\Schema\ObjectSchema;
12-
use EchoLabs\Prism\Schema\StringSchema;
10+
use PrismPHP\Prism\Schema\ArraySchema;
11+
use PrismPHP\Prism\Schema\ObjectSchema;
12+
use PrismPHP\Prism\Schema\StringSchema;
1313

1414
$userSchema = new ObjectSchema(
1515
name: 'user',
@@ -41,7 +41,7 @@ $userSchema = new ObjectSchema(
4141
For text values of any length. Perfect for names, descriptions, or any textual data.
4242

4343
```php
44-
use EchoLabs\Prism\Schema\StringSchema;
44+
use PrismPHP\Prism\Schema\StringSchema;
4545

4646
$nameSchema = new StringSchema(
4747
name: 'full_name',
@@ -54,7 +54,7 @@ $nameSchema = new StringSchema(
5454
Handles both integers and floating-point numbers. Great for ages, quantities, or measurements.
5555

5656
```php
57-
use EchoLabs\Prism\Schema\NumberSchema;
57+
use PrismPHP\Prism\Schema\NumberSchema;
5858

5959
$ageSchema = new NumberSchema(
6060
name: 'age',
@@ -67,7 +67,7 @@ $ageSchema = new NumberSchema(
6767
For simple true/false values. Perfect for flags and toggles.
6868

6969
```php
70-
use EchoLabs\Prism\Schema\BooleanSchema;
70+
use PrismPHP\Prism\Schema\BooleanSchema;
7171

7272
$activeSchema = new BooleanSchema(
7373
name: 'is_active',
@@ -80,8 +80,8 @@ $activeSchema = new BooleanSchema(
8080
For lists of items, where each item follows a specific schema.
8181

8282
```php
83-
use EchoLabs\Prism\Schema\ArraySchema;
84-
use EchoLabs\Prism\Schema\StringSchema;
83+
use PrismPHP\Prism\Schema\ArraySchema;
84+
use PrismPHP\Prism\Schema\StringSchema;
8585

8686
$tagsSchema = new ArraySchema(
8787
name: 'tags',
@@ -95,7 +95,7 @@ $tagsSchema = new ArraySchema(
9595
When you need to restrict values to a specific set of options.
9696

9797
```php
98-
use EchoLabs\Prism\Schema\EnumSchema;
98+
use PrismPHP\Prism\Schema\EnumSchema;
9999

100100
$statusSchema = new EnumSchema(
101101
name: 'status',
@@ -109,9 +109,9 @@ $statusSchema = new EnumSchema(
109109
For complex, nested data structures. The Swiss Army knife of schemas!
110110

111111
```php
112-
use EchoLabs\Prism\Schema\ObjectSchema;
113-
use EchoLabs\Prism\Schema\StringSchema;
114-
use EchoLabs\Prism\Schema\NumberSchema;
112+
use PrismPHP\Prism\Schema\ObjectSchema;
113+
use PrismPHP\Prism\Schema\StringSchema;
114+
use PrismPHP\Prism\Schema\NumberSchema;
115115

116116
$profileSchema = new ObjectSchema(
117117
name: 'profile',
@@ -130,7 +130,7 @@ $profileSchema = new ObjectSchema(
130130
Sometimes, not every field is required. You can make any schema nullable by setting the `nullable` parameter to `true`:
131131

132132
```php
133-
use EchoLabs\Prism\Schema\StringSchema;
133+
use PrismPHP\Prism\Schema\StringSchema;
134134

135135
$bioSchema = new StringSchema(
136136
name: 'bio',

docs/core-concepts/streaming-output.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Want to show AI responses to your users in real-time? Streaming lets you display
77
At its simplest, streaming works like this:
88

99
```php
10-
use EchoLabs\Prism\Prism;
10+
use PrismPHP\Prism\Prism;
1111

1212
$response = Prism::stream()
1313
->using('openai', 'gpt-4')
@@ -44,8 +44,8 @@ foreach ($response as $chunk) {
4444
Streaming works seamlessly with tools, allowing real-time interaction:
4545

4646
```php
47-
use EchoLabs\Prism\Facades\Tool;
48-
use EchoLabs\Prism\Prism;
47+
use PrismPHP\Prism\Facades\Tool;
48+
use PrismPHP\Prism\Prism;
4949

5050
$weatherTool = Tool::as('weather')
5151
->for('Get current weather information')
@@ -95,7 +95,7 @@ Here's how to integrate streaming in a Laravel controller:
9595
Alternatively, you might consider using Laravel's [Broadcasting feature](https://laravel.com/docs/12.x/broadcasting) to send the chunks to your frontend.
9696

9797
```php
98-
use EchoLabs\Prism\Prism;
98+
use PrismPHP\Prism\Prism;
9999
use Illuminate\Http\Response;
100100

101101
public function streamResponse()

0 commit comments

Comments
 (0)