Skip to content

Commit 1d1888b

Browse files
committed
Update support for demos
1 parent cb8294b commit 1d1888b

File tree

3 files changed

+9
-25
lines changed

3 files changed

+9
-25
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -785,14 +785,13 @@ Examples for each OpenAI service have been created in the folder [demo](https://
785785
```
786786
* Run examples:
787787
```
788-
./rundemo.sh <demo> [debug]
788+
./rundemo.sh <demo>
789789
```
790790
Where:
791791

792792
* ```<demo>``` Is mandatory and must be one of the Java files in the folder demo without the suffix `Demo`, for example: _Audio, Chat, ChatMistral, Realtime, AssistantV2, Conversation, ConversationV2, etc._
793793

794-
* ```[debug]``` Is optional and creates the ```demo.log``` file where you can see log details for each execution.
795-
* For example, to run the chat demo with a log file: ```./rundemo.sh Chat debug```
794+
* For example, to run the chat demo with a log file: ```./rundemo.sh Chat```
796795

797796
* Indications for Azure OpenAI demo
798797

rundemo.sh

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
#!/bin/bash
22

3-
service="Model"
4-
5-
log_level_param="-Dorg.slf4j.simpleLogger.defaultLogLevel"
6-
log_level_value="off"
7-
8-
log_file_param="-Dorg.slf4j.simpleLogger.logFile"
9-
log_file_value="demo.log"
10-
11-
log_options=""
3+
java_file="Model"
124

135
if [ ! -z "$1" ]; then
14-
service="$1"
6+
java_file="$1"
157
fi
168

17-
if [ ! -z "$2" ]; then
18-
log_level_value="$2"
19-
fi
20-
21-
if [ "$log_level_value" != "off" ]; then
22-
log_options="${log_level_param}=${log_level_value} ${log_file_param}=${log_file_value}"
23-
fi
9+
main_class="io.github.sashirestela.openai.demo.${java_file}Demo"
2410

25-
main_class="io.github.sashirestela.openai.demo.${service}Demo"
11+
command="mvn exec:java -Dexec.mainClass=${main_class}"
2612

27-
command="mvn exec:java -Dexec.mainClass=${main_class} ${log_options}"
2813
echo $command
2914

30-
eval $command
15+
eval $command

src/main/resources/simplelogger.properties src/demo/resources/simplelogger.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#org.slf4j.simpleLogger.logFile=simple-openai.log
2-
#org.slf4j.simpleLogger.defaultLogLevel=debug
1+
org.slf4j.simpleLogger.logFile=demo.log
2+
org.slf4j.simpleLogger.defaultLogLevel=debug
33
org.slf4j.simpleLogger.showDateTime=true
44
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSSZ
55
org.slf4j.simpleLogger.log.com.github.victools=off

0 commit comments

Comments
 (0)