Skip to content

Commit 2bb94c8

Browse files
committed
🉑 update openai based on the community feedback
- update the sample code. - update readme file.
1 parent 8d44f94 commit 2bb94c8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ For ready integration: try the sample_code.
4444
## Code Example
4545
**Language model code** (2 steps):
4646
```java
47-
// 1- initiate the remote language model
47+
// 1- initiate the remote language model
4848
String apiKey = "<add-openai-api-key>";
4949
RemoteLanguageModel langModel = new RemoteLanguageModel(apiKey, "openai");
5050

5151
// 2- call generateText with any command !
52-
LanguageModelInput langInput = new LanguageModelInput.Builder("return a java code that says hello world")
53-
.setModel("text-davinci-002").setTemperature(0.7f).setMaxTokens(50).build();
52+
LanguageModelInput langInput = new LanguageModelInput.Builder("Summarize the plot of the 'Inception' movie in two sentences")
53+
.setModel("text-davinci-003").setTemperature(0.7f).setMaxTokens(50).build();
5454
String resValue = langModel.generateText(langInput);
5555
```
56-
Output:
57-
``` System.out.println("Hello, World!");```<br><br>
56+
Output:```Inception follows Dom Cobb, a professional thief, who is offered a chance at redemption in exchange for planting an idea in a target's mind. He must navigate a dangerous landscape of dream-sharing technology and battle his inner demons in order to complete the mission and find his way back to reality.```
57+
<br><br>
5858
**Image generation code** (2 steps):
5959
```java
60-
// 1- initiate the remote image model
60+
// 1- initiate the remote image model
6161
RemoateImageModel imageModel = new RemoateImageModel(apiKey, "openai");
6262

6363
// 2- call generateImages with any command !

sample_code/src/com/intelliJava/test/OpenaiApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ private static void tryTheLanguageModel(String apiKey) throws IOException {
6262

6363
// prepare the input parameters - change the prompt to any text like "write a
6464
// funny short story"
65-
LanguageModelInput langInput = new LanguageModelInput.Builder("return a java code that says hello world")
66-
.setModel("text-davinci-002").setTemperature(0.7f).setMaxTokens(50).build();
65+
LanguageModelInput langInput = new LanguageModelInput.Builder("Summarize the plot of the 'Inception' movie in two sentences")
66+
.setModel("text-davinci-003").setTemperature(0.7f).setMaxTokens(80).build();
6767

6868
String resValue = langModel.generateText(langInput);
6969

0 commit comments

Comments
 (0)