File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Original file line number Diff line number Diff line change @@ -126,6 +126,51 @@ OpenAI::assertSent(Completions::class, function (string $method, array $paramete
126
126
127
127
For more testing examples, take a look at the [ openai-php/client] ( https://github.com/openai-php/client#testing ) repository.
128
128
129
+ ## Laravel Pulse
130
+
131
+ This package provides a [ Laravel Pulse] ( https://pulse.laravel.com ) card to show statistics about your OpenAI usage.
132
+
133
+ The card supports two metrics:
134
+ - ** Requests per user** : Shows the number of requests per user.
135
+ - ** Requests per endpoint** : Shows the number of requests per endpoint.
136
+
137
+ ### Installation
138
+
139
+ First, make sure Laravel Pulse is [ installed] ( https://laravel.com/docs/10.x/pulse#installation ) .
140
+
141
+ Next, you need to register the recorder in your ` config/pulse.php ` file:
142
+
143
+ ``` php
144
+ 'recorders' => [
145
+ // ...
146
+
147
+ \OpenAI\Laravel\Pulse\Recorders\OpenAIRequests::class => [
148
+ 'enabled' => env('PULSE_OPENAI_REQUESTS_ENABLED', true),
149
+ 'sample_rate' => env('PULSE_OPENAI_REQUESTS_SAMPLE_RATE', 1),
150
+ 'ignore' => [],
151
+ 'groups' => [
152
+ '/(.*)\/(asst_|file-|ft-|msg_|run_|step_|thread_)[0-9a-zA-Z]*(.*)/' => '\1/\2*\3',
153
+ ],
154
+ ],
155
+ ],
156
+ ```
157
+
158
+ ### Usage
159
+
160
+ Finally, add the card to your pulse ` dashboard.blade.php ` or any other Blade file.
161
+
162
+ ``` blade
163
+ <livewire:openai.pulse.requests />
164
+ ```
165
+
166
+ If you want to be specific about the metric to show, you can pass it as ` type ` :
167
+
168
+ ``` blade
169
+ <livewire:openai.pulse.requests type="endpoint" />
170
+
171
+ <livewire:openai.pulse.requests type="user" />
172
+ ```
173
+
129
174
---
130
175
131
176
OpenAI PHP for Laravel is an open-sourced software licensed under the ** [ MIT license] ( https://opensource.org/licenses/MIT ) ** .
You can’t perform that action at this time.
0 commit comments