@@ -31,7 +31,7 @@ def from_response(cls, dictionary):
3131 ensemble_uuid = dictionary ['ensemble_uuid' ],
3232 definition_uuid = dictionary ['definition_uuid' ],
3333 size = dictionary ['size' ],
34- benchmarks = None
34+ benchmarks = _parse_benchmarks ( dictionary [ 'benchmarks' ])
3535 )
3636
3737 def to_response (self ):
@@ -44,16 +44,7 @@ def to_response(self):
4444
4545 @classmethod
4646 def from_get (cls , response ):
47- # Return hypervectors on get
48- dictionary = json .loads (response .content )
49- ensemble_result = EnsembleResult (
50- ensemble_uuid = dictionary ['ensemble_uuid' ],
51- hypervectors = dictionary ['hypervectors' ],
52- size = dictionary ['size' ],
53- benchmarks = dictionary ['benchmarks' ]
54- )
55-
56- return ensemble_result
47+ return cls .from_response (response .json ())
5748
5849 @classmethod
5950 def list (cls , definition ):
@@ -69,6 +60,11 @@ def new(cls, definition_uuid, size):
6960 response = requests .post (endpoint , json = data , headers = cls .get_headers ()).json ()
7061 return cls .from_response (response )
7162
63+ def hypervectors (self ):
64+ endpoint = f"{ hypervector .API_BASE } /ensemble/{ self .ensemble_uuid } /data"
65+ response = requests .get (endpoint , headers = self .get_headers ()).json ()
66+ return response ['hypervectors' ]
67+
7268
7369class EnsembleResult :
7470
@@ -80,7 +76,7 @@ def __init__(self, ensemble_uuid, hypervectors, size, benchmarks):
8076
8177
8278def _parse_benchmarks (benchmarks ):
83- if not benchmarks :
79+ if not benchmarks or len ( benchmarks ) == 0 :
8480 return None
8581
8682 parsed_benchmarks = []
0 commit comments