-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run a small generation to make sure we have downloaded the cached transformers config.
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from langchain_community.chat_models import ChatOCIGenAI | ||
from langchain_core.messages import HumanMessage, SystemMessage | ||
|
||
from skynet.env import ( | ||
oci_auth_type, | ||
oci_compartment_id, | ||
oci_config_profile, | ||
oci_model_id, | ||
oci_service_endpoint, | ||
use_oci, | ||
) | ||
|
||
|
||
async def initialize(): | ||
if not use_oci: | ||
return | ||
|
||
# Prime it so all transformers config is downloaded. | ||
model_kwargs = { | ||
"temperature": 0, | ||
"frequency_penalty": 1, | ||
"max_tokens": None, | ||
} | ||
|
||
llm = ChatOCIGenAI( | ||
model_id=oci_model_id, | ||
service_endpoint=oci_service_endpoint, | ||
compartment_id=oci_compartment_id, | ||
provider="meta", | ||
model_kwargs=model_kwargs, | ||
auth_type=oci_auth_type, | ||
auth_profile=oci_config_profile, | ||
) | ||
|
||
messages = [ | ||
SystemMessage(content="Your are an AI assistant."), | ||
HumanMessage(content="Hello."), | ||
] | ||
|
||
await llm.ainvoke(messages) |
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