Replies: 3 comments 4 replies
-
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_community.chat_models import ChatPremAI
import os
import getpass
# Set up API key
if "PREMAI_API_KEY" not in os.environ:
os.environ["PREMAI_API_KEY"] = getpass.getpass("PremAI API Key:")
# Initialize the chat client
chat = ChatPremAI(project_id=1234, model_name="gpt-4o")
# Create messages
system_message = SystemMessage(content="You are a friendly assistant.")
human_message = HumanMessage(content="Who are you?")
# Invoke the chat model
response = chat.invoke([system_message, human_message])
print(response.content) |
Beta Was this translation helpful? Give feedback.
2 replies
-
@dosu I'm using
Please modify your code |
Beta Was this translation helpful? Give feedback.
1 reply
-
@dosu : I'd like to use OpenAI also. Please modify the code so I can use OpenAI also. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm looking for a simple chat example without streaming mode in Python.
Beta Was this translation helpful? Give feedback.
All reactions