# Buggy code
def __init__(
    self,
    question: str,
    answer: str,
    is_correct_answer: bool,
    is_correct_document: bool,
    origin: str,
    document_id: Optional[UUID] = None,
    offset_start_in_doc: Optional[int] = None,
    no_answer: Optional[bool] = None,
    model_id: Optional[int] = None,
):
    """
    Object used to represent label/feedback in a standardized way within Haystack.
    This includes labels from dataset like SQuAD, annotations from labeling tools,
    or, user-feedback from the Haystack REST API.

    :param question: the question(or query) for finding answers.
    :param answer: teh answer string.
    :param is_correct_answer: whether the sample is positive or negative.
    :param is_correct_document: in case of negative sample(is_correct_answer is False), there could be two cases;
                                incorrect answer but correct document & incorrect document. This flag denotes if
                                the returned document was correct.
    :param origin: the source for the labels. It can be used to later for filtering.
    :param document_id: the document_store's ID for the returned answer document.
    :param offset_start_in_doc: the answer start offset in the document.
    :param no_answer: whether the question in unanswerable.
    :param model_id: model_id used for prediction(in-case of user feedback).
    """
    self.no_answer = no_answer
    self.origin = origin
    self.question = question
    self.is_correct_answer = is_correct_answer
    self.is_correct_document = is_correct_document
    if document_id:
        if isinstance(document_id, str):
            self.document_id: Optional[UUID] = UUID(hex=str(document_id), version=4)
        if isinstance(document_id, UUID):
            self.document_id = document_id
    else:
        self.document_id = document_id
    self.answer = answer
    self.offset_start_in_doc = offset_start_in_doc
    self.model_id = model_id


# Traceback (ValueError)
07/31/2020 16:12:59 - INFO - haystack.retriever.dpr_utils -   Loading saved model from models/dpr/checkpoint/retriever/single/nq/bert-base-encoder.cp
07/31/2020 16:12:59 - INFO - haystack.retriever.dense -   Loaded encoder params:  {'do_lower_case': True, 'pretrained_model_cfg': 'bert-base-uncased', 'encoder_model_type': 'hf_bert', 'pretrained_file': None, 'projection_dim': 0, 'sequence_length': 256}
07/31/2020 16:13:09 - INFO - haystack.retriever.dense -   Loading saved model state ...
07/31/2020 16:13:09 - INFO - haystack.retriever.dense -   Loading saved model state ...
07/31/2020 16:13:09 - INFO - elasticsearch -   POST https://df4bc7e5f2a54314ac10223dd343fe94.us-central1.gcp.cloud.es.io:9243/document/_search?scroll=5m&amp;size=1000 [status:200 request:0.139s]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-22-9372aaabee19> in <module>()
11 # At query time, we only need to embed the query and compare it the existing doc embeddings which is very fast.
12
---> 13 document_store.update_embeddings(retriever)
14
15 # ES retreivar

5 frames
/usr/lib/python3.6/uuid.py in __init__(self, hex, bytes, bytes_le, fields, int, version)
138             hex = hex.strip('{}').replace('-', '')
139             if len(hex) != 32:
--> 140                 raise ValueError('badly formed hexadecimal UUID string')
141             int = int_(hex, 16)
142         if bytes_le is not None:

**ValueError: badly formed hexadecimal UUID string**

# Fixed code
def __init__(
    self,
    question: str,
    answer: str,
    is_correct_answer: bool,
    is_correct_document: bool,
    origin: str,
    document_id: Optional[str] = None,
    offset_start_in_doc: Optional[int] = None,
    no_answer: Optional[bool] = None,
    model_id: Optional[int] = None,
):
    """
    Object used to represent label/feedback in a standardized way within Haystack.
    This includes labels from dataset like SQuAD, annotations from labeling tools,
    or, user-feedback from the Haystack REST API.

    :param question: the question(or query) for finding answers.
    :param answer: teh answer string.
    :param is_correct_answer: whether the sample is positive or negative.
    :param is_correct_document: in case of negative sample(is_correct_answer is False), there could be two cases;
                                incorrect answer but correct document & incorrect document. This flag denotes if
                                the returned document was correct.
    :param origin: the source for the labels. It can be used to later for filtering.
    :param document_id: the document_store's ID for the returned answer document.
    :param offset_start_in_doc: the answer start offset in the document.
    :param no_answer: whether the question in unanswerable.
    :param model_id: model_id used for prediction(in-case of user feedback).
    """
    self.no_answer = no_answer
    self.origin = origin
    self.question = question
    self.is_correct_answer = is_correct_answer
    self.is_correct_document = is_correct_document
    self.document_id = document_id
    self.answer = answer
    self.offset_start_in_doc = offset_start_in_doc
    self.model_id = model_id