Skip to main content

"A weather query agent using LangChain and OpenWeatherMap API"

Project description

날씨 정보 제공 패키지

목적

이 패키지는 사용자가 OpenWeatherMap API의 일기예보 정보를 간편하게 조회할 수 있도록 돕기 위해 개발되었습니다.

사용하기

이 패키지는 Python 3.11에서 동작을 확인했습니다.

  1. openweathermap api key 발급
  2. openai api key 발급
  3. 프로젝트 루트 혹은 특정 위치에 .env 파일 생성
OPENWEATHERMAP_API_KEY=""
OPENAI_API_KEY=""
  1. 패키지 설치
pip install ask_weather
  1. 실행
from ask_weather.agent import WeatherAgent
# WeatherAgent 인스턴스 생성
agent = WeatherAgent(
    env_path=".env api key file path", # (default. ".env")
    model="only support openai models", # (default. "gpt-4o-mini")
    temperature=0,
    verbose=False,
    max_iterations=10,
    max_execution_time=100000,
    handle_parsing_errors=False,
    return_intermediate_steps=False
)
# 위치와 날짜에 대한 질의
location = "Seoul"
date = "2024-10-15"
query = f"{date}{location} 날씨가 궁금해요."
result = agent.query(query)
print(result)

source에서 패키지 설치

# Poetry로 패키지 설치
poetry install
# poetry env use python3.11

테스트하기

poetry run pytest

package 만들기

  1. pypi 회원가입 후 api key 발급
  2. poetry config pypi-token.pypi api_key 실행
  3. poetry build로 whl 파일 생성
  4. poetry publish --build로 프로젝트 배포

TODO

[] 과거 시간의 기상 상황 검색 [] weather api dictionary 정보 다양하게 활용

reference

이 프로젝트는 위키독스 LangChain 가이드를 참고했습니다.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ask_weather-0.1.5.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ask_weather-0.1.5-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ask_weather-0.1.5.tar.gz.

File metadata

  • Download URL: ask_weather-0.1.5.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.2.0

File hashes

Hashes for ask_weather-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3f0cb7f3fd9bb0895789bce431faa07121ced2704e926440df871a77cf47fc2b
MD5 f725532c5f81a3842ef56271fd0179fb
BLAKE2b-256 3b84c44c88ad70dd8863109cd42fb96553f8a664bbde551ffdc7b1b933c71b35

See more details on using hashes here.

File details

Details for the file ask_weather-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ask_weather-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.2.0

File hashes

Hashes for ask_weather-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1ad22d861e9b30dc76b664352e6ebad52eb4119cc54df4198475efbcb93a8326
MD5 e7e62ed7c0ec390568d5a4a050b50aa8
BLAKE2b-256 4b72e5794cb4144831ae7a2749b95f87b0095b7ba119cbc40ac74908c2fdc75e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page