"A weather query agent using LangChain and OpenWeatherMap API"
Project description
날씨 정보 제공 패키지
목적
이 패키지는 사용자가 OpenWeatherMap API의 일기예보 정보를 간편하게 조회할 수 있도록 돕기 위해 개발되었습니다.
사용하기
이 패키지는 Python 3.11에서 동작을 확인했습니다.
- openweathermap api key 발급
- openai api key 발급
- 프로젝트 루트 혹은 특정 위치에 .env 파일 생성
OPENWEATHERMAP_API_KEY=""
OPENAI_API_KEY=""
- 패키지 설치
pip install ask_weather
- 실행
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 만들기
- pypi 회원가입 후 api key 발급
poetry config pypi-token.pypi api_key실행poetry build로 whl 파일 생성poetry publish --build로 프로젝트 배포
TODO
[] 과거 시간의 기상 상황 검색 [] weather api dictionary 정보 다양하게 활용
reference
이 프로젝트는 위키독스 LangChain 가이드를 참고했습니다.
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f0cb7f3fd9bb0895789bce431faa07121ced2704e926440df871a77cf47fc2b
|
|
| MD5 |
f725532c5f81a3842ef56271fd0179fb
|
|
| BLAKE2b-256 |
3b84c44c88ad70dd8863109cd42fb96553f8a664bbde551ffdc7b1b933c71b35
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ad22d861e9b30dc76b664352e6ebad52eb4119cc54df4198475efbcb93a8326
|
|
| MD5 |
e7e62ed7c0ec390568d5a4a050b50aa8
|
|
| BLAKE2b-256 |
4b72e5794cb4144831ae7a2749b95f87b0095b7ba119cbc40ac74908c2fdc75e
|