Skip to content

Commit

Permalink
Update Examples with new langchain utilites
Browse files Browse the repository at this point in the history
  • Loading branch information
VVoruganti committed Mar 24, 2024
1 parent 462a58e commit 4828c7b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions example/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from langchain_community.chat_models.fake import FakeListChatModel

from honcho import Honcho
from honcho.ext.langchain import _messages_to_langchain
from honcho.ext.langchain import messages_to_langchain

app_name = str(uuid4())

Expand Down Expand Up @@ -36,7 +36,7 @@ def chat():
break
user_message = HumanMessage(content=user_input)
history = list(session.get_messages_generator())
langchain_history = _messages_to_langchain(history)
langchain_history = messages_to_langchain(history)
prompt = ChatPromptTemplate.from_messages(
[system, *langchain_history, user_message]
)
Expand Down
4 changes: 2 additions & 2 deletions example/discord/honcho-dspy-personas/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from uuid import uuid1
import discord
from honcho import Honcho
from honcho.ext.langchain import _messages_to_langchain
from honcho.ext.langchain import messages_to_langchain
from graph import chat
from dspy import Example

Expand Down Expand Up @@ -61,7 +61,7 @@ async def on_message(message):
session = user.create_session(location_id)

history = list(session.get_messages_generator())[:5]
chat_history = _messages_to_langchain(history)
chat_history = messages_to_langchain(history)

inp = message.content
user_message = session.create_message(is_user=True, content=inp)
Expand Down
4 changes: 2 additions & 2 deletions example/discord/honcho-fact-memory/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from uuid import uuid1
import discord
from honcho import Honcho
from honcho.ext.langchain import _messages_to_langchain
from honcho.ext.langchain import messages_to_langchain
from chain import LMChain


Expand Down Expand Up @@ -59,7 +59,7 @@ async def on_message(message):
session = user.create_session(location_id)

history = list(session.get_messages_generator())
chat_history = _messages_to_langchain(history)
chat_history = messages_to_langchain(history)

inp = message.content
user_message = session.create_message(is_user=True, content=inp)
Expand Down
5 changes: 2 additions & 3 deletions example/discord/simple-roast-bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from langchain_core.messages import AIMessage, HumanMessage

from honcho import Honcho
from honcho.ext.langchain import _messages_to_langchain
>>>>>>> main
from honcho.ext.langchain import messages_to_langchain

load_dotenv()

Expand Down Expand Up @@ -68,7 +67,7 @@ async def on_message(message):
session = user.create_session(location_id)

history = list(session.get_messages_generator())
chat_history = _messages_to_langchain(history)
chat_history = messages_to_langchain(history)

inp = message.content
session.create_message(is_user=True, content=inp)
Expand Down

0 comments on commit 4828c7b

Please sign in to comment.