code: def test_log_data_with_vectors_and_partial_update_ok(api: Argilla):
      dataset = "test_log_data_and_partial_update_ok"
      text = "This is a text"
      expected_n_records = 10
  
      delete_ignoring_errors(dataset)
  
      # Logging records with vector info
  
      records = [
          argilla.TokenClassificationRecord(
              id=i,
              text=text,
              tokens=text.split(),
              vectors={"test-vector": [i] * 5},
          )
          for i in range(0, expected_n_records)
      ]
      api.log(records=records, name=dataset)
  
      ds = api.load(dataset)
      assert len(ds) == expected_n_records
      assert all(map(lambda r: "test-vector" in r.vectors, ds))
  
      # Fetch minimal record info and add a metadata field
      records_for_update = [
          TokenClassificationRecord.parse_obj(
              {"metadata": {"a": "value"}, **data}
          )
          for data in api.datasets.scan(
              name=dataset, projection={"text", "tokens"}
          )
      ]
      api.log(name=dataset, records=records_for_update)
  
      ds = api.load(dataset)
      assert len(ds) == expected_n_records
      assert all(map(lambda r: r.annotation_agent is None, ds))
      assert all(map(lambda r: "test-vector" in r.vectors, ds))
      assert all(map(lambda r: r.metadata == {"a": "value"}, ds))
  
      # Remove the metadata info and add some mock annotations
      for record in records_for_update:
          record.metadata = None
          record.annotation = []
          record.annotation_agent = "mock_test"
      api.log(name=dataset, records=records_for_update)
  
      ds = api.load(dataset)
      assert len(ds) == expected_n_records
      assert all(map(lambda r: r.annotation_agent == "mock_test", ds))
      assert all(map(lambda r: "test-vector" in r.vectors, ds))
      assert all(map(lambda r: r.metadata == {"a": "value"}, ds))
  
file_path: argilla/tests/integration/test_log_for_token_classification.py
imports: import argilla
  import pytest
  from argilla import TokenClassificationRecord
  from argilla.client import api
  from argilla.client.client import Argilla
  from argilla.client.sdk.commons.errors import NotFoundApiError
  from argilla.client.singleton import ArgillaSingleton
  from argilla.metrics import __all__
  from argilla.metrics import entity_consistency
  from tests.integration.utils import delete_ignoring_errors
label_desc: Use image node_id 7 for calling a global function with example usage: test_log_data_with_vectors_and_partial_update_ok(api) without return types