In Google Gemini kann nicht integriert werdenPython

Python-Programme
Anonymous
 In Google Gemini kann nicht integriert werden

Post by Anonymous »

Als Anfänger habe ich begonnen, Langgraph in die Integration mit Gemini zu erkunden, aber leere Antwort zu erhalten. Es scheint, als wäre die Langchain nicht mit Gemini-2,5-Flash-< /p>
alte Versionen veraltet. Es wird mir helfen, Langchain und Langgraph zu lernen. Es scheint, als wäre die Langchain nicht mit Gemini-2,5-Flash < /p>
kompatibel. Bitte teilen Sie einige Codeausschnitte mit, die mit dem Gemini-Modell funktionieren. Es wird mir helfen, Langchain und Langgraph zu lernen.

Code: Select all

import os
from dotenv import load_dotenv
from langchain_google_vertexai import VertexAI
from google.cloud import aiplatform

# Load .env values into [url=viewtopic.php?t=25360]environment[/url] variables
load_dotenv()

# Ensure correct region is used
aiplatform.init(location="us-central1")

# Confirm that key path is loaded correctly
print("GOOGLE_APPLICATION_CREDENTIALS =", os.getenv("GOOGLE_APPLICATION_CREDENTIALS"))

llm = VertexAI(model_name="gemini-2.5-flash", temperature=0.7, max_output_tokens=512)

response = llm.invoke("Hello from Gemini via Vertex AI")
print(response)
print("Response type:", type(response))
< /code>
Requirement.txt
langgraph
langgraph-prebuilt
langchain
langchain-core
langchain-community
langchain-openai
langchain-google-genai
google-generativeai
python-dotenv
google-cloud-aiplatform
langchain-google-vertexai

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post