-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: mkdir if no dir, feat: alert file metadata * feat: add cola example * fix: formatting * feat: working updates but no db edit * feat: working commit alert 0 * feat: add drive demo * feat: ordered docs in alert * fix: edit document for example * add: experiments * feat: last edit, prettify meta info * feat: carry some utils under example_utils * fix: add init for import * fix: format * fix: how to run * fix: drive example refactor * fix: adjust prompt * fix: rm line from json * fix: remove logs, explain example_utils * fix: remove drive example from pr * fix: rm commented out, use logging * fix: refactor * fix: remove experimental commits * fix: typo, add exception for openai requestor * fix: rm duplicate key in exception * fix: gitignore * fix: remove comment, logging * fix: change description * feat: log slack notif to terminal * fix: openai log shorten * fix: token to key in example * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * Update public/llm-app/examples/pipelines/alert/app.py Co-authored-by: Jan Chorowski <[email protected]> * fix: long lines --------- Co-authored-by: Jan Chorowski <[email protected]> GitOrigin-RevId: a2424f719a2bedb20e988790d9cd19c927de23c3
- Loading branch information
1 parent
034fd97
commit 1aa06f9
Showing
9 changed files
with
152 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,3 +160,6 @@ cython_debug/ | |
#.idea/ | ||
|
||
pw-env/ | ||
|
||
# llm debug | ||
examples/ui/data/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .example_utils import find_last_modified_file, get_file_info | ||
|
||
__all__ = [ | ||
"find_last_modified_file", | ||
"get_file_info", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"doc": "We will launch Logitech campaign in July 2023"} | ||
{"doc": "Ohio store opening is delayed until further notice."} | ||
{"doc": "Campaign for Magic Cola is going to start in November 2023."} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"doc": "Country director had discussion with local managers and they agreed to push start of campaign of Magic Cola to January 1st, 2024. Please plan accordingly."} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import os | ||
import pwd | ||
import time | ||
|
||
|
||
def find_last_modified_file(directory) -> str: | ||
"""These functions are meant to be replaced with functionality from Pathway""" | ||
"""Retrieves last added or modified file path. | ||
Args: | ||
directory (str, Path): path of the directory for search | ||
Returns: | ||
path (str, Path): full path of the found last modified file | ||
""" | ||
latest_file = None | ||
latest_time = 0 | ||
|
||
if os.path.exists(directory) and os.path.isdir(directory): | ||
for root, dirs, files in os.walk(directory): | ||
for file in files: | ||
file_path = os.path.join(root, file) | ||
file_time = os.path.getmtime(file_path) | ||
file_time_create = os.path.getctime(file_path) | ||
|
||
file_time = max(file_time_create, file_time) | ||
|
||
if file_time > latest_time: | ||
latest_time = file_time | ||
latest_file = file_path | ||
|
||
if latest_file is not None: | ||
return latest_file | ||
else: | ||
return None | ||
else: | ||
return None | ||
|
||
|
||
def get_file_info(file_path) -> dict: | ||
"""These functions are meant to be replaced with functionality from Pathway""" | ||
"""Retrieves os info about a given file. | ||
Args: | ||
file_path (str, Path): path of the file | ||
Returns: | ||
response (dict): dict containing information about file | ||
""" | ||
try: | ||
modification_time = os.path.getmtime(file_path) | ||
create_time = os.path.getctime(file_path) | ||
modified_time_str = time.ctime(modification_time) | ||
create_time_str = time.ctime(create_time) | ||
|
||
last_edit = max(modification_time, create_time) | ||
last_edit_time_str = time.ctime(last_edit) | ||
|
||
owner_id = os.stat(file_path).st_uid | ||
owner_name = pwd.getpwuid(owner_id).pw_name | ||
|
||
return { | ||
"File": file_path.split(os.sep)[-1], | ||
"Modified Time": modified_time_str, | ||
"Created Time": create_time_str, | ||
"Owner": owner_name, | ||
"Last Edit": last_edit_time_str, | ||
} | ||
except Exception as e: | ||
return {"Error": str(e)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters