> ## Documentation Index
> Fetch the complete documentation index at: https://unstructured-53-kapa-ai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Pinecone

> Batch process all your records using `unstructured-ingest` to store structured outputs and embeddings locally on your filesystem and upload those to a Pinecone index.

First you’ll need to install the Pinecone dependencies as shown here.

```bash
pip install "unstructured[pinecone]"

```

## Run Locally

The upstream connector can be any of the ones supported, but for convenience here, showing a sample command using the upstream local connector.

<CodeGroup>
  ```bash Shell
  #!/usr/bin/env bash

  EMBEDDING_PROVIDER=${EMBEDDING_PROVIDER:-"langchain-huggingface"}

  unstructured-ingest \
    local \
    --input-path example-docs/book-war-and-peace-1225p.txt \
    --output-dir local-output-to-pinecone \
    --strategy fast \
    --chunk-elements \
    --embedding-provider "$EMBEDDING_PROVIDER" \
    --num-processes 2 \
    --verbose \
    pinecone \
    --api-key "$PINECONE_API_KEY" \
    --index-name "$PINECONE_INDEX_NAME" \
    --environment "$PINECONE_ENVIRONMENT" \
    --batch-size 80
  ```

  ```python Python
  import os

  from unstructured.ingest.connector.local import SimpleLocalConfig
  from unstructured.ingest.connector.pinecone import (
      PineconeAccessConfig,
      PineconeWriteConfig,
      SimplePineconeConfig,
  )
  from unstructured.ingest.interfaces import (
      ChunkingConfig,
      EmbeddingConfig,
      PartitionConfig,
      ProcessorConfig,
      ReadConfig,
  )
  from unstructured.ingest.runner import LocalRunner
  from unstructured.ingest.runner.writers.base_writer import Writer
  from unstructured.ingest.runner.writers.pinecone import (
      PineconeWriter,
  )


  def get_writer() -> Writer:
      return PineconeWriter(
          connector_config=SimplePineconeConfig(
              access_config=PineconeAccessConfig(api_key=os.getenv("PINECONE_API_KEY")),
              index_name=os.getenv("PINECONE_INDEX_NAME"),
              environment=os.getenv("PINECONE_ENVIRONMENT_NAME"),
          ),
          write_config=PineconeWriteConfig(batch_size=80),
      )


  if __name__ == "__main__":
      writer = get_writer()
      runner = LocalRunner(
          processor_config=ProcessorConfig(
              verbose=True,
              output_dir="local-output-to-pinecone",
              num_processes=2,
          ),
          connector_config=SimpleLocalConfig(
              input_path="example-docs/book-war-and-peace-1225p.txt",
          ),
          read_config=ReadConfig(),
          partition_config=PartitionConfig(),
          chunking_config=ChunkingConfig(chunk_elements=True),
          embedding_config=EmbeddingConfig(
              provider="langchain-huggingface",
          ),
          writer=writer,
          writer_kwargs={},
      )
      runner.run()
  ```
</CodeGroup>

For a full list of the options the CLI accepts check `unstructured-ingest <upstream connector> pinecone --help`.

NOTE: Keep in mind that you will need to have all the appropriate extras and dependencies for the file types of the documents contained in your data storage platform if you’re running this locally. You can find more information about this in the [installation guide](/open-source/installation/overview).
