-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into florence2-aliases
- Loading branch information
Showing
94 changed files
with
8,731 additions
and
258 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
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
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
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
Empty file.
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,78 @@ | ||
# TODO - for everyone: start migrating other handlers to bring relief to http_api.py | ||
from typing import List, Optional | ||
|
||
from inference.core.entities.responses.workflows import ( | ||
ExternalBlockPropertyPrimitiveDefinition, | ||
ExternalWorkflowsBlockSelectorDefinition, | ||
UniversalQueryLanguageDescription, | ||
WorkflowsBlocksDescription, | ||
) | ||
from inference.core.workflows.core_steps.common.query_language.introspection.core import ( | ||
prepare_operations_descriptions, | ||
prepare_operators_descriptions, | ||
) | ||
from inference.core.workflows.execution_engine.dynamic_blocks.block_assembler import ( | ||
compile_dynamic_blocks, | ||
) | ||
from inference.core.workflows.execution_engine.dynamic_blocks.entities import ( | ||
DynamicBlockDefinition, | ||
) | ||
from inference.core.workflows.execution_engine.introspection.blocks_loader import ( | ||
describe_available_blocks, | ||
) | ||
from inference.core.workflows.execution_engine.introspection.connections_discovery import ( | ||
discover_blocks_connections, | ||
) | ||
|
||
|
||
def handle_describe_workflows_blocks_request( | ||
dynamic_blocks_definitions: Optional[List[DynamicBlockDefinition]] = None, | ||
) -> WorkflowsBlocksDescription: | ||
if dynamic_blocks_definitions is None: | ||
dynamic_blocks_definitions = [] | ||
dynamic_blocks = compile_dynamic_blocks( | ||
dynamic_blocks_definitions=dynamic_blocks_definitions, | ||
) | ||
blocks_description = describe_available_blocks(dynamic_blocks=dynamic_blocks) | ||
blocks_connections = discover_blocks_connections( | ||
blocks_description=blocks_description, | ||
) | ||
kinds_connections = { | ||
kind_name: [ | ||
ExternalWorkflowsBlockSelectorDefinition( | ||
manifest_type_identifier=c.manifest_type_identifier, | ||
property_name=c.property_name, | ||
property_description=c.property_description, | ||
compatible_element=c.compatible_element, | ||
is_list_element=c.is_list_element, | ||
is_dict_element=c.is_dict_element, | ||
) | ||
for c in connections | ||
] | ||
for kind_name, connections in blocks_connections.kinds_connections.items() | ||
} | ||
primitives_connections = [ | ||
ExternalBlockPropertyPrimitiveDefinition( | ||
manifest_type_identifier=primitives_connection.manifest_type_identifier, | ||
property_name=primitives_connection.property_name, | ||
property_description=primitives_connection.property_description, | ||
type_annotation=primitives_connection.type_annotation, | ||
) | ||
for primitives_connection in blocks_connections.primitives_connections | ||
] | ||
uql_operations_descriptions = prepare_operations_descriptions() | ||
uql_operators_descriptions = prepare_operators_descriptions() | ||
universal_query_language_description = ( | ||
UniversalQueryLanguageDescription.from_internal_entities( | ||
operations_descriptions=uql_operations_descriptions, | ||
operators_descriptions=uql_operators_descriptions, | ||
) | ||
) | ||
return WorkflowsBlocksDescription( | ||
blocks=blocks_description.blocks, | ||
declared_kinds=blocks_description.declared_kinds, | ||
kinds_connections=kinds_connections, | ||
primitives_connections=primitives_connections, | ||
universal_query_language_description=universal_query_language_description, | ||
dynamic_block_definition_schema=DynamicBlockDefinition.schema(), | ||
) |
Oops, something went wrong.