-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding AWS SDK and using for LlamaAWSHandler
- Loading branch information
1 parent
2af0d77
commit 4eb2a07
Showing
6 changed files
with
172 additions
and
32 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
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
43 changes: 43 additions & 0 deletions
43
src/test/java/com/meta/chatbridge/llm/LlamaAWSHandlerTest.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
package com.meta.chatbridge.llm; | ||
|
||
import com.meta.chatbridge.Identifier; | ||
import com.meta.chatbridge.message.FBMessage; | ||
import com.meta.chatbridge.message.Message; | ||
import com.meta.chatbridge.store.LLMContextManager; | ||
import com.meta.chatbridge.store.MessageStack; | ||
|
||
import java.time.Instant; | ||
|
||
import software.amazon.awssdk.regions.Region; | ||
|
||
public class LlamaAWSHandlerTest { | ||
|
||
public static void main(String[] args) { | ||
Region region = Region.US_EAST_2; | ||
String endpoint = "jumpstart-dft-meta-textgeneration-llama-2-7b-f"; | ||
LLMContextManager context = new LLMContextManager("Always answer with emojis"); | ||
|
||
LlamaAWSHandler llmhandler = new LlamaAWSHandler(context, endpoint, region); | ||
|
||
FBMessage userMessage = new FBMessage( | ||
Instant.now(), | ||
Identifier.from("123"), | ||
Identifier.from("456"), | ||
Identifier.from("789"), | ||
"How to go from San Francisco to NY?", | ||
Message.Role.USER | ||
); | ||
MessageStack<FBMessage> messageStack = MessageStack.of(userMessage); | ||
|
||
Message response = llmhandler.handle(messageStack); | ||
System.out.println(response.message()); | ||
} | ||
} |