You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/Filament/Resources/ApiResource.php
+27-8
Original file line number
Diff line number
Diff line change
@@ -43,12 +43,16 @@ class ApiResource extends Resource
43
43
publicstaticfunctionform(Form$form): Form
44
44
{
45
45
if($form->getOperation() == 'create'){
46
+
$introDescription = Placeholder::make('')->content('Create an API for an AI service and define the API options & configuration. API creation will help you specify which service configurations can be changeable through an API call (API option) and which configurations are predefined (can not be changed in an API call).')->columnSpanFull();
Forms\Components\TextInput::make('name')->required()->maxLength(40)->columnSpanFull()->live(debounce: 500)->afterStateUpdated(function (Get$get, Set$set) { $set('endpoint', Str::slug($get('name'))); })->helperText('Any name to help you identify this API.'),
->helperText(newHtmlString('Should we use specific collections to help AI answer user questions? (this method is called RAG "<b>Retrieval Augmented Generation</b>").<br><b>What is RAG?</b> <a class="underline" href="https://research.ibm.com/blog/retrieval-augmented-generation-RAG" target=_blank>What is retrieval-augmented generation?</a> <a class="underline" href="https://huggingface.co/docs/transformers/model_doc/rag" target=_blank>RAG Overview</a>' )),
99
+
83
100
Grid::make()
84
101
->schema(
85
-
function (Get$get, Set$set, string$operation, API$record){
102
+
function (Get$get, Set$set, string$operation, API$record = null){
@@ -91,7 +108,9 @@ function (Get $get, Set $set, string $operation, API $record){
91
108
$set('initiated', true);
92
109
}
93
110
$groups = $get('optionGroups') ?? [];
94
-
$sections = [];
111
+
$sections = [
112
+
Placeholder::make('')->content('Specify which service configurations can be changeable through an API call (API option) and which configurations are predefined (can not be changed in an API call).')->columnSpanFull()->visible(fn (Get$get): bool => (bool) $get('optionGroups') ?? false),
113
+
];
95
114
foreach($groupsas$group){
96
115
$sections[] =Section::make($group)
97
116
->schema(
@@ -118,7 +137,7 @@ function (Get $get) use($group) {
Copy file name to clipboardExpand all lines: app/Filament/Resources/AppResource.php
+15-3
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@
15
15
useFilament\Forms\Set;
16
16
useFilament\Forms\Components\Actions\Action;
17
17
useFilament\Support\Enums\FontWeight;
18
+
useFilament\Forms\Components\Placeholder;
19
+
useIlluminate\Support\HtmlString;
18
20
19
21
class AppResource extends Resource
20
22
{
@@ -26,20 +28,28 @@ class AppResource extends Resource
26
28
27
29
publicstaticfunctionform(Form$form): Form
28
30
{
31
+
if($form->getOperation() == 'create'){
32
+
$introDescription = Placeholder::make('')->content('Create an App and associate APIs to it so you can use Auth Token to access them from your application.');
33
+
}else{
34
+
$introDescription = Placeholder::make('')->content('Edit an App and associate APIs to it so you can use Auth Token to access them from your application.');
35
+
}
29
36
return$form
30
37
->schema([
38
+
$introDescription,
31
39
Forms\Components\TextInput::make('name')
32
40
->required()
41
+
->helperText('Any name to help you identify this app.')
33
42
->maxLength(40),
34
43
Forms\Components\TextInput::make('description')
35
44
->maxLength(255),
36
45
Forms\Components\TextInput::make('owner')
37
46
->maxLength(60),
38
47
Forms\Components\TextInput::make('authToken')
48
+
->helperText(newHtmlString('Bearer authentication tokens that you can use to access any of the associate APIs. <a href="https://swagger.io/docs/specification/authentication/bearer-authentication/">Bearer Authentication</a>'))
39
49
->required()
40
50
->minLength(50)
41
51
->maxLength(100)
42
-
->label('Auth Token')
52
+
->label('Bearer Token')
43
53
->suffixAction(
44
54
Action::make('RegenerateAuthToken')
45
55
->icon('heroicon-s-key')
@@ -50,12 +60,14 @@ public static function form(Form $form): Form
Copy file name to clipboardExpand all lines: app/Filament/Resources/CollectionResource.php
+28-1
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,9 @@
15
15
useFilament\Forms\Set;
16
16
useFilament\Forms\Components\Actions\Action;
17
17
useFilament\Support\Enums\FontWeight;
18
+
useFilament\Forms\Components\Placeholder;
19
+
useFilament\Forms\Components\Hidden;
20
+
useIlluminate\Support\HtmlString;
18
21
19
22
class CollectionResource extends Resource
20
23
{
@@ -26,14 +29,31 @@ class CollectionResource extends Resource
26
29
protectedstatic ?int$navigationSort = 1;
27
30
publicstaticfunctionform(Form$form): Form
28
31
{
32
+
if($form->getOperation() == 'create'){
33
+
$introDescription = Placeholder::make('')->content(newHtmlString("A Collection serves as a structured data store for text-based <b>documents</b>. You can populate this Collection either via the Collection API endpoint or through the Admin Portal.
34
+
<br><br>
35
+
The primary function of a Collection is to extend the knowledge base accessible by an AI service. When creating an API, you can specify which Collection the AI should reference for its responses. This allows you to tailor the AI's behavior and the information it draws upon, depending on the context in which it's used.
36
+
<br><br>
37
+
<b>Example Use Case:</b>
38
+
Suppose you have a chatbot aimed at handling HR-related queries (HRChatBot). You can create a Collection named 'HR_Policies' and upload all relevant HR documents into it. When a user asks a question to your 'HR ChatBot' or your 'ERP', the backend can be configured to call the API, which will then consult the 'HR_Policies' Collection to retrieve and generate a response based on the information it contains.
39
+
<br><br>
40
+
<b>Technical Note:</b>
41
+
This mechanism utilizes a method known as Retrieval-Augmented Generation (RAG). RAG empowers the AI to scan the Collection and identify the most relevant information to construct its responses."))->columnSpanFull();
->helperText('Bearer authentication tokens that you can use to access this Collection via the Collection APIs.')
55
+
->label('Bearer Token')
56
+
37
57
->required()
38
58
->minLength(50)
39
59
->maxLength(100)
@@ -58,20 +78,27 @@ public static function form(Form $form): Form
58
78
6 => '6 Documents',
59
79
7 => '7 Documents',
60
80
])
61
-
->label('Max Documents to inject in LLM requests?')
81
+
->label('Max Documents to share with AI service for each API call?')
62
82
->required()
63
83
->default(3),
64
84
Forms\Components\Select::make('loader_id')
85
+
->label('Documents Loader')
86
+
->helperText('Document loader provides a "load/download" and "extract text" method for any specified URL or file (will work only when using Collection API).')
->helperText('Often times you want to split large text into smaller chunks to better work with language models. TextSplitters are responsible for splitting up large text into smaller documents (will work only when using Collection API).')
->helperText('Embeddings create a vector representation of a document to do things like semantic search where we look for pieces of text that are most similar to an API query.')
$introDescription = Placeholder::make('')->content(newHtmlString('Use this form to upload documents to any collection. You can also use the Collection APIs to integrate with other systems.
34
+
<br><br>We will not use Text Splitter for documents created via this page.'))->columnSpanFull();
@@ -37,11 +47,15 @@ public static function form(Form $form): Form
37
47
->required()
38
48
->hiddenOn(DocumentsRelationManager::class),
39
49
Forms\Components\Textarea::make('content')
40
-
->required()
41
-
->rows(8)
42
-
->columnSpanFull(),
50
+
->label('Document Content')
51
+
->helperText(newHtmlString('<b>- Make sure you don\'t have any sensitive information in the document.<br>- Consider the LLM token limits that can be processed in a single interaction (System message + Document(s) + History + User Question).</b>'))
52
+
->required()
53
+
->rows(8)
54
+
->columnSpanFull(),
43
55
44
56
Forms\Components\KeyValue::make('meta')
57
+
->label('Meta Data')
58
+
->helperText('Specify any metadata you would like to associate with this document (will be returned in the API response).')
0 commit comments