Skip to content

Commit

Permalink
0.1.0 (#25)
Browse files Browse the repository at this point in the history
# Changelog

## [0.0.2a5](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a5)
(2024-05-06)

[Full
Changelog](0.0.2a4...0.0.2a5)

**Merged pull requests:**

- Update config documentation and resolve security warning
[\#24](#24)
([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.2a4](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a4)
(2024-05-06)

[Full
Changelog](0.0.2a3...0.0.2a4)

**Merged pull requests:**

- Fix kwarg handling for backend compat.
[\#22](#22)
([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.2a3](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a3)
(2024-04-10)

[Full
Changelog](0.0.2a2...0.0.2a3)

**Merged pull requests:**

- Include email API error responses in HTTP response
[\#19](#19)
([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.2a2](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a2)
(2024-04-10)

[Full
Changelog](0.0.2a1...0.0.2a2)

**Implemented enhancements:**

- \[FEAT\] Weather API Language Support
[\#15](#15)

**Merged pull requests:**

- Add `lang_code` optional param to weather endpoint
[\#18](#18)
([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.2a1](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a1)
(2024-04-09)

[Full
Changelog](0.0.1...0.0.2a1)

**Implemented enhancements:**

- \[FEAT\] Stock API region support
[\#16](#16)

**Merged pull requests:**

- Support `region` in stock search requests
[\#17](#17)
([NeonDaniel](https://github.com/NeonDaniel))



\* *This Changelog was automatically generated by
[github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
  • Loading branch information
NeonDaniel authored May 6, 2024
2 parents 41d0a73 + c57270b commit 2a475ff
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 45 deletions.
55 changes: 19 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,52 @@
# Changelog

## [0.0.1a9](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a9) (2024-02-26)
## [0.0.2a5](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a5) (2024-05-06)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a8...0.0.1a9)
[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.2a4...0.0.2a5)

**Merged pull requests:**

- Cleanup comments and prep for release [\#13](https://github.com/NeonGeckoCom/neon-hana/pull/13) ([NeonDaniel](https://github.com/NeonDaniel))
- Update config documentation and resolve security warning [\#24](https://github.com/NeonGeckoCom/neon-hana/pull/24) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a8](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a8) (2024-01-26)
## [0.0.2a4](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a4) (2024-05-06)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a7...0.0.1a8)
[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.2a3...0.0.2a4)

**Merged pull requests:**

- Update to use client-provided public IP address when available [\#12](https://github.com/NeonGeckoCom/neon-hana/pull/12) ([NeonDaniel](https://github.com/NeonDaniel))
- Fix kwarg handling for backend compat. [\#22](https://github.com/NeonGeckoCom/neon-hana/pull/22) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a7](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a7) (2024-01-26)
## [0.0.2a3](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a3) (2024-04-10)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a6...0.0.1a7)
[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.2a2...0.0.2a3)

**Merged pull requests:**

- Add Node data model and Session support [\#11](https://github.com/NeonGeckoCom/neon-hana/pull/11) ([NeonDaniel](https://github.com/NeonDaniel))
- Include email API error responses in HTTP response [\#19](https://github.com/NeonGeckoCom/neon-hana/pull/19) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a6](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a6) (2024-01-26)
## [0.0.2a2](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a2) (2024-04-10)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a5...0.0.1a6)
[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.2a1...0.0.2a2)

**Merged pull requests:**

- Configurable Authorization Request Limits [\#9](https://github.com/NeonGeckoCom/neon-hana/pull/9) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a5](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a5) (2024-01-23)
**Implemented enhancements:**

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a4...0.0.1a5)
- \[FEAT\] Weather API Language Support [\#15](https://github.com/NeonGeckoCom/neon-hana/issues/15)

**Merged pull requests:**

- JWT server cache fix and client response update [\#8](https://github.com/NeonGeckoCom/neon-hana/pull/8) ([NeonDaniel](https://github.com/NeonDaniel))
- Add `lang_code` optional param to weather endpoint [\#18](https://github.com/NeonGeckoCom/neon-hana/pull/18) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a4](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a4) (2024-01-22)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a3...0.0.1a4)

**Merged pull requests:**

- Default disable email service with note in docs explaining rationale [\#4](https://github.com/NeonGeckoCom/neon-hana/pull/4) ([NeonDaniel](https://github.com/NeonDaniel))

## [0.0.1a3](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a3) (2024-01-22)

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1a2...0.0.1a3)

**Merged pull requests:**
## [0.0.2a1](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.2a1) (2024-04-09)

- Add `assist` route for HTTP requests [\#3](https://github.com/NeonGeckoCom/neon-hana/pull/3) ([NeonDaniel](https://github.com/NeonDaniel))
[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/0.0.1...0.0.2a1)

## [0.0.1a2](https://github.com/NeonGeckoCom/neon-hana/tree/0.0.1a2) (2024-01-19)
**Implemented enhancements:**

[Full Changelog](https://github.com/NeonGeckoCom/neon-hana/compare/885ec6ef0f8ddcaa8127f60730ef7b4011127554...0.0.1a2)
- \[FEAT\] Stock API region support [\#16](https://github.com/NeonGeckoCom/neon-hana/issues/16)

**Merged pull requests:**

- Fix path errors in test build automation [\#2](https://github.com/NeonGeckoCom/neon-hana/pull/2) ([NeonDaniel](https://github.com/NeonDaniel))
- Initial Implementation [\#1](https://github.com/NeonGeckoCom/neon-hana/pull/1) ([NeonDaniel](https://github.com/NeonDaniel))
- Support `region` in stock search requests [\#17](https://github.com/NeonGeckoCom/neon-hana/pull/17) ([NeonDaniel](https://github.com/NeonDaniel))



Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ User configuration belongs in `diana.yaml`, mounted in the container path
MQ:
server: mq.mydomain.com
hana:
server_host: '0.0.0.0'
port: 8080
mq_default_timeout: 10
access_token_ttl: 86400 # 1 day
refresh_token_ttl: 604800 # 1 week
Expand Down
4 changes: 3 additions & 1 deletion neon_hana/app/routers/api_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@

@proxy_route.post("/weather")
async def api_proxy_weather(query: WeatherAPIRequest) -> WeatherAPIOnecallResponse:
return mq_connector.query_api_proxy("open_weather_map", dict(query))
query = dict(query)
query["lang"] = query.pop("lang_code")
return mq_connector.query_api_proxy("open_weather_map", query)


@proxy_route.post("/stock/symbol")
Expand Down
17 changes: 14 additions & 3 deletions neon_hana/mq_service_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ def __init__(self, config: dict):
self.sessions_by_id = dict()

@staticmethod
def _validate_api_proxy_response(response: dict):
def _validate_api_proxy_response(response: dict, query_params: dict):
if response['status_code'] == 200:
try:
resp = json.loads(response['content'])
if query_params.get('service') == "alpha_vantage":
resp['service'] = query_params['service']
if query_params.get("region") and resp.get('bestMatches'):
filtered = [
stock for stock in resp.get("bestMatches")
if stock.get("4. region") == query_params["region"]]
resp['bestMatches'] = filtered
if isinstance(resp, dict):
return resp
# Reverse Geocode API returns a list; reformat that to a dict
Expand Down Expand Up @@ -85,9 +92,12 @@ def get_session(self, node_data: NodeData) -> dict:
def query_api_proxy(self, service_name: str, query_params: dict,
timeout: int = 10):
query_params['service'] = service_name
if service_name in ("open_weather_map", "wolfram_alpha"):
query_params['units'] = query_params.pop('unit',
query_params.get('units'))
response = send_mq_request("/neon_api", query_params, "neon_api_input",
"neon_api_output", timeout)
return self._validate_api_proxy_response(response)
return self._validate_api_proxy_response(response, query_params)

def query_llm(self, llm_name: str, query: str, history: List[tuple]):
response = send_mq_request("/llm", {"query": query,
Expand All @@ -112,7 +122,8 @@ def send_email(self, recipient: str, subject: str, body: str,
response = send_mq_request("/neon_emails", request_data,
"neon_emails_input")
if not response.get("success"):
raise APIError(status_code=500, detail="Email failed to send")
error = response.get("error") or "Email failed to send"
raise APIError(status_code=500, detail=error)

def upload_metric(self, metric_name: str, timestamp: str,
metric_data: Dict[str, Any]):
Expand Down
9 changes: 6 additions & 3 deletions neon_hana/schema/api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,30 @@ class WeatherAPIRequest(BaseModel):
lat: float
lon: float
unit: str = "metric"

lang_code: str = "en"
model_config = {
"json_schema_extra": {
"examples": [{
"api": "onecall",
"lat": 47.6815,
"lon": -122.2087,
"unit": "imperial",
"lang_code": "en"
}, {
"api": "onecall",
"lat": 47.6815,
"lon": -122.2087,
"unit": "metric",
"unit": "metric"
}]}}


class StockAPISymbolRequest(BaseModel):
company: Optional[str] = None
region: Optional[str] = None
model_config = {
"json_schema_extra": {
"examples": [{"company": "microsoft"}]}}
"examples": [{"company": "microsoft",
"region": "United States"}]}}


class StockAPIQuoteRequest(BaseModel):
Expand Down
2 changes: 2 additions & 0 deletions neon_hana/schema/api_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,7 @@ class StockAPIQuoteResponse(BaseModel):
"json_schema_extra": {
"examples": [
{
"provider": "alpha_vantage",
"Global Quote": {
"01. symbol": "GOOG",
"02. open": "144.8950",
Expand All @@ -1771,6 +1772,7 @@ class StockAPISearchResponse(BaseModel):
"json_schema_extra": {
"examples": [
{
"provider": "alpha_vantage",
"bestMatches": [
{
"1. symbol": "MSF0.FRK",
Expand Down
2 changes: 1 addition & 1 deletion neon_hana/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "0.0.1"
__version__ = "0.1.0"
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyyaml>=5.4,<7.0
fastapi~=0.95
fastapi~=0.95,>=0.109.1
uvicorn~=0.25
pydantic~=2.5
pyjwt~=2.8
Expand Down

0 comments on commit 2a475ff

Please sign in to comment.