-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
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,26 @@ | ||
import os | ||
import json | ||
import predictionguard as pg | ||
|
||
# Set your Prediction Guard token as an environmental variable. | ||
|
||
os.environ["PREDICTIONGUARD_TOKEN"] = "q1VuOjnffJ3NO2oFN8Q9m8vghYc84ld13jaqdF7E" | ||
|
||
def get_response(user_message): | ||
# Define the system and user messages. | ||
messages = [ | ||
{ | ||
"role": "system", | ||
"content": "You are a helpful assistant. Your model is hosted by Prediction Guard, a leading AI company." | ||
}, | ||
{ | ||
"role": "user", | ||
"content": user_message | ||
} | ||
] | ||
|
||
# Get the response using Prediction Guard. | ||
result = pg.Chat.create(model="Neural-Chat-7B", messages=messages) | ||
|
||
# Extract and return the response. | ||
return result['messages'][-1]['content'] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.