Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow running flow from json #32

Merged
merged 7 commits into from
Apr 20, 2023
Merged

allow running flow from json #32

merged 7 commits into from
Apr 20, 2023

Conversation

Liavatrix
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2023

Codecov Report

Merging #32 (3008975) into main (ee21614) will decrease coverage by 1.96%.
The diff coverage is 62.66%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
- Coverage   73.49%   71.54%   -1.96%     
==========================================
  Files          16       17       +1     
  Lines         449      485      +36     
==========================================
+ Hits          330      347      +17     
- Misses        119      138      +19     
Impacted Files Coverage Δ
...nibridge/model_entities/models_io/base_model_io.py 80.00% <ø> (-1.25%) ⬇️
...bridge/wrappers/wrapper_instances/dalle_wrapper.py 63.26% <ø> (ø)
...rappers/wrapper_instances/hugging_face_wrappers.py 38.88% <0.00%> (ø)
omnibridge/cli/create/create_command_handler.py 53.84% <25.00%> (-3.30%) ⬇️
omnibridge/model_entities/models_io/flow_io.py 56.75% <56.75%> (ø)
...dge/wrappers/wrapper_instances/rest_api_wrapper.py 86.04% <72.72%> (-5.13%) ⬇️
omnibridge/flows/branching_flow.py 69.76% <85.71%> (+0.71%) ⬆️
omnibridge/flows/sequential_flow.py 69.69% <100.00%> (+1.12%) ⬆️
omnibridge/version.py 100.00% <100.00%> (ø)
...wrappers/wrapper_instances/type_name_to_wrapper.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines 40 to 42
if 'models' in json_data:
next_models_data = json_data['models']
for next_model_data in next_models_data:
Copy link
Contributor

@Eliran-Turgeman Eliran-Turgeman Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a suggestion, IMO it is clearer that way

Suggested change
if 'models' in json_data:
next_models_data = json_data['models']
for next_model_data in next_models_data:
for next_model_data in json_data.get('models', [])

Comment on lines 35 to 37
instruction = ""
if 'instruction' in json_data:
instruction = json_data['instruction']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a suggestion, IMO it is clearer that way

Suggested change
instruction = ""
if 'instruction' in json_data:
instruction = json_data['instruction']
instruction = json_data.get('instruction', '')


def process(self, model_input: ModelIO) -> ModelIO:
assert isinstance(model_input, TextualIO)
model_input = TextualIO(model_input.get_text() + "\n" + self.instruction)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a suggestion, f-strings are the standard in Python + slight performance advantage over concatenation.

Suggested change
model_input = TextualIO(model_input.get_text() + "\n" + self.instruction)
model_input = TextualIO(f'{model_input.get_text()}\n{self.instruction}')

Comment on lines +45 to +47
retries = 2
retry_delay = 30 # seconds
for attempt in range(retries):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following the talk we had this morning, do we still need a retry mechanism?
If so, I think moving the functionality into a decorator is favorable, wdyt?
for example: https://stackoverflow.com/questions/50246304/using-python-decorators-to-retry-request

Copy link
Contributor

@Eliran-Turgeman Eliran-Turgeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@Liavatrix Liavatrix merged commit db37c50 into main Apr 20, 2023
@Liavatrix Liavatrix deleted the jsonFlows branch April 20, 2023 21:08
github-actions bot pushed a commit that referenced this pull request Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants