in google/generativeai/types/model_types.py [0:0]
def _convert_dict(data, input_key, output_key):
new_data = list()
try:
inputs = data[input_key]
except KeyError:
raise KeyError(
f"Invalid key: The input key '{input_key}' does not exist in the data. "
f"Available keys are: {sorted(data.keys())}."
)
try:
outputs = data[output_key]
except KeyError:
raise KeyError(
f"Invalid key: The output key '{output_key}' does not exist in the data. "
f"Available keys are: {sorted(data.keys())}."
)
for i, o in zip(inputs, outputs):
new_data.append(protos.TuningExample({"text_input": str(i), "output": str(o)}))
return protos.Dataset(examples=protos.TuningExamples(examples=new_data))