6
6
7
7
This package is your go-to solution for integrating OpenAI's powerful API into your LLM Agents projects.
8
8
9
- ## What's in the box?
9
+ ## What's in the box?
10
10
11
11
- Easy setup with Spiral framework
12
12
- Smooth integration with OpenAI's API
@@ -22,13 +22,15 @@ composer require llm-agents/openai-client
22
22
23
23
2 . That's it! You're ready to roll.
24
24
25
- ## Setting it up 🔧
25
+ ### Setting it up in Spiral
26
26
27
- To get the OpenAI client up and running in your Spiral app, you need to register the bootloader. Here's how:
27
+ To get the OpenAI client up and running in your Spiral app, you need to register the bootloader.
28
+
29
+ ** Here's how:**
28
30
29
31
1 . Open up your ` app/src/Application/Kernel.php ` file.
30
32
31
- 2 . In your ` Kernel ` class, find or create the ` defineBootloaders() ` method and add the ` OpenAIClientBootloader ` :
33
+ 2 . In your ` Kernel ` class add the ` LLM\Agents\OpenAI\Client\Integration\Spiral\ OpenAIClientBootloader` bootloader :
32
34
33
35
``` php
34
36
class Kernel extends \Spiral\Framework\Kernel
@@ -37,22 +39,51 @@ class Kernel extends \Spiral\Framework\Kernel
37
39
{
38
40
return [
39
41
// ... other bootloaders ...
40
- \LLM\Agents\OpenAI\Client\Bootloader \OpenAIClientBootloader::class,
42
+ \LLM\Agents\OpenAI\Client\Integration\Spiral \OpenAIClientBootloader::class,
41
43
];
42
44
}
43
45
}
44
46
```
45
47
46
- ## Configuration ⚙️
48
+ The package uses your OpenAI API key and organization (if you have one) to authenticate.
47
49
48
- The package uses your OpenAI API key and organization (if you have one) to authenticate. Set these up in your ` .env `
49
- file:
50
+ Set these up in your ` .env ` file:
50
51
51
52
```
52
53
OPENAI_KEY=your_api_key_here
53
54
```
54
55
55
- ## Contributing
56
+ ### Setting it up in Laravel
57
+
58
+ If you're using the Laravel framework, you'll need to install the ` openai-php/laravel ` package register the Service
59
+ provider.
60
+
61
+ ** Here's how:**
62
+
63
+ 1 . Install the ` openai-php/laravel ` package:
64
+
65
+ ``` bash
66
+ composer require openai-php/laravel
67
+ ```
68
+
69
+ 2 . Next, execute the install command:
70
+
71
+ ``` bash
72
+ php artisan openai:install
73
+ ```
74
+
75
+ 3 . Finally, add your OpenAI API key to your ` .env ` file:
76
+
77
+ ```
78
+ OPENAI_API_KEY=sk-...
79
+ OPENAI_ORGANIZATION=org-...
80
+ ```
81
+
82
+ 4 . And register the ` LLM\Agents\OpenAI\Client\Integration\Laravel\OpenAIClientServiceProvider `
83
+
84
+ And that's it! The service provider will take care of registering the ` LLMInterface ` for you.
85
+
86
+ ## Contributing
56
87
57
88
We're always happy to get help making this package even better! Here's how you can chip in:
58
89
@@ -62,7 +93,7 @@ We're always happy to get help making this package even better! Here's how you c
62
93
63
94
Please make sure your code follows PSR-12 coding standards and include tests for any new features.
64
95
65
- ## License
96
+ ## License
66
97
67
98
This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
68
99
0 commit comments