2024/9/1 langchain-google-vertexai は ChatVertexAI を使うべし
VertexAI と ChatVertexAI がある
シングルターンとマルチターンチャットに対応している
VertexAI 側は放置され気味?
code:diff
# VertexAI 側はパラメータの扱いが違う
llm_flash = VertexAI(
model_name="gemini-1.5-flash-001",
).bind(
response_mime_type="application/json", # コンストラクタで渡してもダメ
response_schema=schema, # スキーマ渡しても動作しない、 gPRC のパラメータ作成にコケる
)
# Chat はこれで動く
chat_flash = ChatVertexAI(
model_name="gemini-1.5-flash-001",
response_mime_type="application/json",
response_schema=schema,
)
それぞれ llms.py と chat_models.py に対応している
https://github.com/langchain-ai/langchain-google/blame/main/libs/vertexai/langchain_google_vertexai/llms.py
7 months ago なコミットが多いなー...
https://github.com/langchain-ai/langchain-google/blame/main/libs/vertexai/langchain_google_vertexai/chat_models.py
こちらは更新されている
なんかもっとコード共通でいい気がするけどな...
Issue たてつつ Chat 側使っていくのがよさそう
#LangChain