이 노트북은 agent를 사용하여 NASA toolkit과 상호작용하는 방법을 보여줍니다. 이 toolkit은 NASA Image and Video Library API에 대한 액세스를 제공하며, 향후 반복에서 다른 접근 가능한 NASA API를 확장하고 포함할 가능성이 있습니다. 참고: NASA Image and Video Library 검색 쿼리는 원하는 미디어 결과 수가 지정되지 않은 경우 대용량 응답을 생성할 수 있습니다. LLM 토큰 크레딧으로 agent를 사용하기 전에 이 점을 고려하세요.

사용 예시


Agent 초기화

pip install -qU langchain-community
from langchain.agents import AgentType, initialize_agent
from langchain_community.agent_toolkits.nasa.toolkit import NasaToolkit
from langchain_community.utilities.nasa import NasaAPIWrapper
from langchain_openai import OpenAI

llm = OpenAI(temperature=0, openai_api_key="")
nasa = NasaAPIWrapper()
toolkit = NasaToolkit.from_nasa_api_wrapper(nasa)
agent = initialize_agent(
    toolkit.get_tools(), llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True
)

미디어 자산 쿼리

agent.run(
    "Can you find three pictures of the moon published between the years 2014 and 2020?"
)

미디어 자산에 대한 세부 정보 쿼리

output = agent.run(
    "I've just queried an image of the moon with the NASA id NHQ_2019_0311_Go Forward to the Moon."
    " Where can I find the metadata manifest for this asset?"
)

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I