MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / encode_string_by_tiktoken

Function encode_string_by_tiktoken

autoagent/registry.py:9–12  ·  view source on GitHub ↗
(content: str, model_name: str = "gpt-4o")

Source from the content-addressed store, hash-verified

7MAX_OUTPUT_LENGTH = 12000
8
9def encode_string_by_tiktoken(content: str, model_name: str = "gpt-4o"):
10 ENCODER = tiktoken.encoding_for_model(model_name)
11 tokens = ENCODER.encode(content)
12 return tokens
13
14
15def decode_tokens_by_tiktoken(tokens: list[int], model_name: str = "gpt-4o"):

Callers 1

truncate_outputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected