How to avoid this error for llama-3-8b-instruct? `must have required property 'prompt', must NOT ha

How to avoid this error for llama-3-8b-instruct?

must have required property 'prompt', must NOT have more than 6144 characters, must match exactly one schema in oneOf

Can anyone provide an example of the correct typescript code to check the prompt size and trim it? I use the messages array, which I pass to the llm model call; in this array there is an arbitrary number of nested arrays with the keys “user/system/assistant” and “content.
Was this page helpful?