MCPcopy Create free account
hub / github.com/deepseek-ai/DeepSpec / compute_context_length

Function compute_context_length

scripts/data/generate_train_data.py:57–67  ·  view source on GitHub ↗
(conversations)

Source from the content-addressed store, hash-verified

55
56
57def compute_context_length(conversations):
58 length = 0
59 for message in conversations:
60 content = message.get("content")
61 if isinstance(content, str):
62 length += len(content.split())
63 elif isinstance(content, list):
64 for part in content:
65 if isinstance(part, dict) and isinstance(part.get("text"), str):
66 length += len(part["text"].split())
67 return length
68
69
70def build_query_kwargs(args, messages, max_tokens=None):

Callers 1

write_finished_resultFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected