(content: str, model_name: str = "gpt-4o")
| 156 | |
| 157 | return prediction_json |
| 158 | def encode_string_by_tiktoken(content: str, model_name: str = "gpt-4o"): |
| 159 | global ENCODER |
| 160 | if ENCODER is None: |
| 161 | ENCODER = tiktoken.encoding_for_model(model_name) |
| 162 | tokens = ENCODER.encode(content) |
| 163 | return tokens |
| 164 | |
| 165 | # Set a random seed for reproducibility |
| 166 | RANDOM_SEED = 224 |
no outgoing calls
no test coverage detected