K1.<a>=NumberField(x^2+1);K1#K1 is Q(i)#sage only knows how to compute Hilbert class fields of imaginary quadratic fields. MAGMA can compute Hilbert class fields of arbitrary fields.
Number Field in a with defining polynomial x^2 + 1
H1=K1.hilbert_class_field('b');H1#H1 is K1[x]/(x) = K1, as expected as K1 has trivial class group
Number Field in b with defining polynomial x over its base field
K2.<a>=NumberField(x^2+23);K2#K2 is the ring of integers in Q(sqrt(-23))
Number Field in a with defining polynomial x^2 + 23
H2=K2.hilbert_class_field('b');H2#Hilbert class field is a cubic extension
Number Field in b with defining polynomial x^3 - x^2 + 1 over its base field