-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added Mistral-7B-Instruct-v0.3 support using Jumpstart (#553)
* chore: Upgraded dependencies + fix code analytics warning * test: Add sagemaker integ test. * chore: Migrate file upload script to langchain 0.2 --------- Co-authored-by: Nikolai Grinko <grinko.nikolai@gmail.com>
- Loading branch information
1 parent
3075d2c
commit 21de272
Showing
18 changed files
with
154 additions
and
34 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,68 @@ | ||
# This test will only run if the dolly sagemaker endpoint was create. | ||
# It aims to validate the sagemaker flow | ||
import json | ||
import time | ||
import uuid | ||
|
||
import pytest | ||
|
||
|
||
def test_jumpstart_sagemaker_endpoint(client): | ||
model_name = "mistralai/Mistral-7B-Instruct-v0.3" | ||
models = client.list_models() | ||
model = next(i for i in models if i.get("name") == model_name) | ||
if model is None: | ||
pytest.skip("Mistra v0.3 is not enabled.") | ||
session_id = str(uuid.uuid4()) | ||
request = { | ||
"action": "run", | ||
"modelInterface": "langchain", | ||
"data": { | ||
"mode": "chain", | ||
"text": "Hello, my name is Tom.", | ||
"files": [], | ||
"modelName": model_name, | ||
"provider": "sagemaker", | ||
"sessionId": session_id, | ||
}, | ||
"modelKwargs": {"maxTokens": 150}, | ||
} | ||
|
||
client.send_query(json.dumps(request)) | ||
|
||
found = False | ||
retries = 0 | ||
while not found and retries < 20: | ||
time.sleep(1) | ||
retries += 1 | ||
session = client.get_session(session_id) | ||
if ( | ||
session != None | ||
and len(session.get("history")) == 2 | ||
and "tom" in session.get("history")[1].get("content").lower() | ||
): | ||
found = True | ||
break | ||
assert found == True | ||
|
||
request = request.copy() | ||
# The goal here is to test the conversation history | ||
request["data"]["text"] = "What is my name?" | ||
|
||
client.send_query(json.dumps(request)) | ||
|
||
found = False | ||
retries = 0 | ||
while not found and retries < 20: | ||
time.sleep(1) | ||
retries += 1 | ||
session = client.get_session(session_id) | ||
if ( | ||
session != None | ||
and len(session.get("history")) == 4 | ||
and "tom" in session.get("history")[3].get("content").lower() | ||
): | ||
found = True | ||
break | ||
|
||
assert found == True |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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