harukaxq / langchain-book Goto Github PK
View Code? Open in Web Editor NEW書籍「LangChain完全入門」で作成するソースコードです。
書籍「LangChain完全入門」で作成するソースコードです。
お世話になっております。
06_agent/agent_5.py 「文脈に応じた返答ができるAgentを作成する」で、
1回目の実行結果はちゃんとスコッチウィスキーの内容を返答するのですが、
2回目の実行結果が「2回目の実行結果: 以前の指示をもう一度実行してください。」と
質問文をそのまま返すのみとなります。
Python Versionは3.11.8で、
Readmeのpython3 -m pip install -r requirements.txt
も実行しました。
2回目の実行結果がただ単に質問文をそのまま返すだけなのはなぜでしょうか?
以下のように変更する必要があると思います。
誤:
```
result = chat([
HumanMessage(content=prompt.format(documents=documents_string,
query=input_message)) #← input_messageに変更
])
```
正:
```
result = chat([
HumanMessage(content=prompt.format(document=documents_string,
query=input_message)) #← input_messageに変更
])
```
documents -> document
04_memory/chat_memory_1.py をWindows環境で起動すると、最初の入力で以下のエラーが出てしまいます。対処法をご教授ください。
1 validation error for HumanMessage
content
str type expected (type=type_error.str)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.