Skip to content

Commit

Permalink
Update support for demos
Browse files Browse the repository at this point in the history
  • Loading branch information
sashirestela committed Feb 11, 2025
1 parent cb8294b commit 1d1888b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -785,14 +785,13 @@ Examples for each OpenAI service have been created in the folder [demo](https://
```
* Run examples:
```
./rundemo.sh <demo> [debug]
./rundemo.sh <demo>
```
Where:

* ```<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._

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

* Indications for Azure OpenAI demo

Expand Down
25 changes: 5 additions & 20 deletions rundemo.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
#!/bin/bash

service="Model"

log_level_param="-Dorg.slf4j.simpleLogger.defaultLogLevel"
log_level_value="off"

log_file_param="-Dorg.slf4j.simpleLogger.logFile"
log_file_value="demo.log"

log_options=""
java_file="Model"

if [ ! -z "$1" ]; then
service="$1"
java_file="$1"
fi

if [ ! -z "$2" ]; then
log_level_value="$2"
fi

if [ "$log_level_value" != "off" ]; then
log_options="${log_level_param}=${log_level_value} ${log_file_param}=${log_file_value}"
fi
main_class="io.github.sashirestela.openai.demo.${java_file}Demo"

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

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

eval $command
eval $command
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#org.slf4j.simpleLogger.logFile=simple-openai.log
#org.slf4j.simpleLogger.defaultLogLevel=debug
org.slf4j.simpleLogger.logFile=demo.log
org.slf4j.simpleLogger.defaultLogLevel=debug
org.slf4j.simpleLogger.showDateTime=true
org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSSZ
org.slf4j.simpleLogger.log.com.github.victools=off
Expand Down

0 comments on commit 1d1888b

Please sign in to comment.