Create a text splitter
POST/text-splitters
Creates a text splitter: a configured instance of a text splitter provider, with parameters. A text splitter has no name, and a deployment can hold several text splitters of the same provider. Before storing the text splitter, Foundation4 splits a test string with the provider, so the request fails when the provider does not accept the parameters. After creation, only description can change.
Permissions. Write on the text-splitters object type and write on the text splitter provider that provider names. The key that creates the text splitter receives read, write and execute permission on the new text splitter.
Embedding models and text splitters shows example requests, and Providers and models lists the parameters of each provider.
Request
Responses
- 201
- 400
- 401
- 403
- 404
- 422
- 500
- 503
The text splitter was created. The body is the new text splitter.
The provider does not accept the parameters (Invalid parameter, with Text splitter provider '<provider>' not found or invalid parameters provided: <reason> in details.error), or the body is not valid JSON. RecursiveJsonSplitter always receives this status, because the test string is not JSON.
The authentication headers are missing or invalid, or the API key is inactive or expired. Errors lists the messages.
The key lacks write permission on the text-splitters object type (Unauthorized: write access to Text Splitter required) or on the text splitter provider (Unauthorized: write access to Text Splitter Provider required, with Creating a text splitter needs write access on the provider <provider> in details.error). The same status reports a license that is not valid (Invalid license: <reason>) and a reached license limit (License limits exceeded for Text Splitter).
No text splitter provider has the name in provider (Text Splitter Provider not found, with the name in details.provider).
The body does not match the request schema, for example a missing provider or an unknown field.
The provider failed while splitting the test string, for example because the gRPC service is unreachable (Internal server error). The API server log records the cause.
The gRPC service lacks the package or the model files that the provider needs, such as the spaCy package for SpacyTextSplitter (Provider unavailable, with the reason in details.error).