-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LangChain導入とGeminiを使った旅行プラン作成のサンプル作成 #9
Conversation
実際にリリースする際にはドメインで制限かける
そもそものサンプルコードが改善の余地あり
※ プロンプトはおいおい調整しなきゃいけない
lazyにして先にloadして無駄なAPI叩かないように
chakra-ui v3にかわってめっちゃ使いにくくなった気がする...
※GoogleMapは旅行先だけ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NOTE]
ui配下の差分はすべて自動生成
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NOTE]
routes/samples配下の差分は
このファイル以外みなくてok!
ただし本当に利用する際にはもう少しチューニングが必要なのでその点だけ気をつけうこと
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NOTE]
https://js.langchain.com/v0.1/docs/modules/model_io/output_parsers/types/structured/
このあたり。
zodでjsonの戻り値を定義して、langchainに渡すと、langchain側でいい感じにpromptを作ってLLMになげてくれる。
このおかげで構造化された状態でアプリケーションはもろもろデータを使える。
@@ -20,3 +20,6 @@ dist-ssr | |||
*.njsproj | |||
*.sln | |||
*.sw? | |||
|
|||
# for LLM context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初見やったわ。
Devinもええけど高すぎるし全自動すぎるから、安く自力でできるようにしたい場合はrepomixを使って対話する方が勉強できて良きやな。
- Google Mapの経路は、旅行先の経由地のみを含めてください。出発地は含めないでください。 | ||
- Google Mapの出発地と目的地は、旅行先の出発地と目的地のみを含めてください。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NOTE]
このあたり工夫することでGoogleMapの経路は旅行先だけにしてます。
ただし、旅費は出発地を考慮して出してもらうようにしてます
<具体例>
東京から北海道の2泊3日の旅行は
東京 <-> 北海道
の旅費も必要だけどGoogleMapの経路としては不要
import { z } from "zod"; | ||
|
||
const model = new ChatGoogleGenerativeAI({ | ||
modelName: "gemini-2.0-flash-exp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gemini2.0が異常に精度が高いので2.0にしてます
あと2.0がGAになるまではこのmodelは無料で利用できるのでとてもお得
※ ただし学習されちゃうので個人情報はいれないこと
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ごめん、確認遅くなった!
というか、全部sample作ってくれて、、ほんまにありがとう(なんも実装してなくてごめん)
LGTM!
<Field label={"出発地"} mb={4} required> | ||
<NativeSelectRoot size="sm" width="240px"> | ||
<NativeSelectField | ||
placeholder="Select option" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NITS]
必須入力のselect要素でplaceholderが選択できるのが気になったけど、Chakra的には今の実装をsampleとして提供してたし、そもそもこの実装もsampleやしで、一旦気にせんでも良さそうやから、
(動作確認しましたよアピールのために)コメントだけ失礼しま
(旅行先をSelect optionで旅行プランを作成してみたら、沖縄に行くことになってたw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
実は必須に見えて必須になっていないんだよねw
送信できちゃう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Select optionを選択した場合には、ガチャガチャ要素にさせるという逆転の発想やわ。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
旅行先をSelect optionで旅行プランを作成してみたら、沖縄に行くことになってたw
...
ガチャガチャ要素にさせるという逆転の発想やわ。
そういうことか、たしかにそれは良さそうw
@@ -20,3 +20,6 @@ dist-ssr | |||
*.njsproj | |||
*.sln | |||
*.sw? | |||
|
|||
# for LLM context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
初見やったわ。
Devinもええけど高すぎるし全自動すぎるから、安く自力でできるようにしたい場合はrepomixを使って対話する方が勉強できて良きやな。
やったこと
差分多くてすまぬ
新規導入系
※ LangChainはLLMを使うのを楽にしてくれるライブラリどす
主に以下3つ
refactor系
samples/
に移動させた残タスク
あとは宿泊先を取れるようにするために、以下のどちらかを実施したい