-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
open ai, pojo, actions , refactoring
- Loading branch information
1 parent
1ab6f52
commit 8ad2164
Showing
24 changed files
with
120 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.example; | ||
|
||
import com.t4a.processor.AIProcessingException; | ||
import com.t4a.processor.OpenAiActionProcessor; | ||
import lombok.extern.java.Log; | ||
import org.example.actions.AddRestaurantAction; | ||
|
||
@Log | ||
public class OpenAIActionExample { | ||
public static void main(String[] args) throws AIProcessingException { | ||
OpenAiActionProcessor processor = new OpenAiActionProcessor(); | ||
String promptTxt ="Sachin Tendulkar is very good cricket player, " + | ||
"he joined the sports on 24032022, he has played 300 matches " + | ||
"and his max score is 400. Can you send him a congratulations email"; | ||
String response = (String)processor.processSingleAction(promptTxt); | ||
response = processor.query(promptTxt,response); | ||
log.info(response); | ||
|
||
|
||
promptTxt = "Sachin Tendulkar is very good cricket player, \" +\n" + | ||
" \"he joined the sports on 24032022, he has played 300 matches \" +\n" + | ||
" \"and his max score is 400." + | ||
"can you book Maharaja restaurant in " + | ||
"Toronto for Sachin Tendulkar and 4 people on 12th may. Please notify him and the restaurant "; | ||
response = (String)processor.processSingleAction(promptTxt); | ||
log.info(response); | ||
|
||
promptTxt ="Maharaja restaurant in \" +\n" + | ||
" \"Toronto for Sachin Tendulkar and 4 people on 12th may"; | ||
response = (String)processor.processSingleAction(promptTxt, new AddRestaurantAction()); | ||
log.info(response); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.example; | ||
|
||
import com.t4a.predict.OpenAIPromptTransformer; | ||
import com.t4a.processor.AIProcessingException; | ||
import org.example.pojo.MyTranslatePojo; | ||
|
||
public class TranslationPojoExample { | ||
public static void main(String[] args) throws AIProcessingException { | ||
OpenAIPromptTransformer tra = new OpenAIPromptTransformer(); | ||
String promptTxt = "paneer is so good"; | ||
MyTranslatePojo myp = (MyTranslatePojo)tra.transformIntoPojo(promptTxt,MyTranslatePojo.class.getName()); | ||
System.out.println(myp); | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
...java/org/example/AddRestaurantAction.java → .../example/actions/AddRestaurantAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ain/java/org/example/FileWriteAction.java → .../org/example/actions/FileWriteAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
.../java/org/example/GoogleSearchAction.java → ...g/example/actions/GoogleSearchAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
.../java/org/example/NotifyPlayerAction.java → ...g/example/actions/NotifyPlayerAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
...g/example/PlayerWithRestaurantAction.java → ...e/actions/PlayerWithRestaurantAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/java/org/example/SimpleAction.java → ...ava/org/example/actions/SimpleAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/java/org/example/WeatherAction.java → ...va/org/example/actions/WeatherAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.example.pojo; | ||
|
||
import com.t4a.annotations.Prompt; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@ToString | ||
public class MyTranslatePojo { | ||
@Prompt(describe = "translate to Hindi") | ||
String answerInHindi; | ||
@Prompt(describe = "translate to Punjabi") | ||
String answerInPunJabi; | ||
|
||
@Prompt(describe = "translate to Tamil") | ||
String answerInTamil; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/java/org/example/RestaurantDetails.java → ...a/org/example/pojo/RestaurantDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.example; | ||
package org.example.pojo; | ||
|
||
public class RestaurantDetails { | ||
String name; | ||
|
4 changes: 3 additions & 1 deletion
4
...main/java/org/example/RestaurantPojo.java → ...java/org/example/pojo/RestaurantPojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/java/org/example/script/actions/BookFlightAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/java/org/example/script/actions/ServerRestartAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/main/java/org/example/script/actions/SightSeeingAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters