The chemistry of protoplanetary fragments formed via gravitational instabilities