Created
October 8, 2023 23:12
-
-
Save robert-mcdermott/2c6eb4976d2ba07f20a5f3477c6fd6d7 to your computer and use it in GitHub Desktop.
chatting with local ollama using langchain
This file contains hidden or 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
from langchain.chat_models import ChatOllama | |
from langchain.callbacks.manager import CallbackManager | |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler | |
from langchain.schema import HumanMessage | |
chat_model = ChatOllama(model="mistral", base_url = "http://localhost:11434", callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])) | |
#chat_model = ChatOllama(model="mistral") | |
messages = [ | |
HumanMessage(content="Why is the sky blue?") | |
] | |
chat_model(messages) | |
#print(chat_model(messages)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment