File tree 2 files changed +29
-5
lines changed
2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ git clone https://github.com/centreonlabs/plugin-output-processing.git
60
60
61
61
cd plugin-output-processing
62
62
63
- docker compose --profile ollama up
63
+ docker- compose --profile ollama up
64
64
```
65
65
66
66
After the container is up, you can try the API at ` http://localhost:8000/docs ` .
@@ -82,7 +82,7 @@ This method requires an [OpenAI API key](https://help.openai.com/en/articles/493
82
82
``` bash
83
83
export OPENAI_API_KEY=...
84
84
85
- docker compose up
85
+ docker- compose up
86
86
```
87
87
88
88
After the container is up, you can try the API the same way as the previous section.
@@ -92,17 +92,17 @@ After the container is up, you can try the API the same way as the previous sect
92
92
> If you want to use the OpenAI API, you must unset the ` OLLAMA_HOST ` if it exists and can reach an ollama instance.
93
93
94
94
> [ !CAUTHION]
95
- > If you want to switch between providers (OpenAI to Ollama or vice versa), you must change the configuration file or removing it.
95
+ > If you want to switch between providers (OpenAI to Ollama or vice versa), you must change the configuration file or remove it.
96
96
97
97
``` bash
98
98
# Example to switch from OpenAI to Ollama
99
99
100
- docker compose down
100
+ docker- compose down
101
101
102
102
docker volume rm pop_pop
103
103
104
104
# We need to recreate the network because ollama will start first.
105
- docker compose --profile ollama up --force-recreate
105
+ docker- compose --profile ollama up --force-recreate
106
106
```
107
107
108
108
### Running the API locally
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # This script prompts the user to input plugin output text, URL encodes the input,
4
+ # and sends it to a specified API endpoint for explanation. The response from the
5
+ # API is then formatted and displayed to the user.
6
+
7
+ # Prompt the user to input text
8
+ read -p " Enter plugin output you want to be explained: " input_text
9
+
10
+ echo
11
+ echo " ----------"
12
+ echo
13
+
14
+ # URL encode the input text
15
+ encoded_text=$( echo -n " $input_text " | jq -s -R -r @uri)
16
+
17
+ # Define the API endpoint, replacing YOUR_API_ENDPOINT with the actual endpoint
18
+ api_endpoint=" http://127.0.0.1:8000/explain"
19
+
20
+ # Make the GET request
21
+ response=$( curl -s " ${api_endpoint} ?type=service&output=${encoded_text} " )
22
+
23
+ # replace return carriage and display the response
24
+ echo $response | sed ' s/\\n/\n/g'
You can’t perform that action at this time.
0 commit comments