John 3843af666e
feat: Enable remote chunking via unstructured-ingest (#2905)
Update: The cli shell script works when sending documents to the free
api, but the paid api is down, so waiting to test against it.

- The first commit adds docstrings and fixes type hints.
- The second commit reorganizes `test_unstructured_ingest` so it matches
the structure of `unstructured/ingest`.
- The third commit contains the primary changes for this PR.
- The `.chunk()` method responsible for sending elements to the correct
method is moved from `ChunkingConfig` to `Chunker` so that
`ChunkingConfig` acts as a config object instead of containing
implementation logic. `Chunker.chunk()` also now takes a json file
instead of a list of elements. This is done to avoid redundant
serialization if the file is to be sent to the api for chunking.

---------

Co-authored-by: Ahmet Melek <39141206+ahmetmeleq@users.noreply.github.com>
2024-04-25 00:24:58 +00:00

19 lines
366 B
Python

import click
import pytest
from unstructured.ingest.cli.interfaces import CliMixin
def test_add_params():
@click.command()
def sample_cmd():
pass
options = [
click.Option(["--opt1"]),
click.Option(["--opt1"]),
]
cmd = sample_cmd
with pytest.raises(ValueError):
CliMixin.add_params(cmd=cmd, params=options)