MCPcopy
hub / github.com/kaixindelele/ChatPaper / token_str

Method token_str

HuggingFaceDeploy/Private/optimizeOpenAI.py:223–224  ·  view source on GitHub ↗
(self,content:str)

Source from the content-addressed store, hash-verified

221 def token_cost(self,convo_id: str = "default"):
222 return len(ENCODER.encode("\n".join([x["content"] for x in self.conversation[convo_id]])))
223 def token_str(self,content:str):
224 return len(ENCODER.encode(content))
225def main():
226 return

Callers 3

__init__Method · 0.95
askMethod · 0.95
conversation_summaryMethod · 0.95

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected