---
# System prepended metadata

title: PID-1276

---

To craft a function that associates the `step_description` as the key with `step_history` as the corresponding value, and subsequently transmits both step_description and step_history to the Pinecone vector database, you can employ the Pinecone Python SDK [2][4]. Here's a function that accomplishes this task:
```python
import pinecone

def pinecone_upsert(step_description, step_history):
    # Define your Pinecone API key and index name
    api_key = "YOUR_API_KEY"
    index_name = "YOUR_INDEX_NAME"

    # Initialize a Pinecone client
    client = pinecone.Client(api_key=api_key)

    try:
        # Upsert the data with step_description as the key and step_description as the value
        data = {step_description: step_description}
        client.upsert(index_name, data)

        print(f"Successfully upserted data: {data}")
    except pinecone.ApiException as e:
        print(f"Pinecone API Exception: {e}")
    except Exception as e:
        print(f"An error occurred: {e}")

# Example usage:
# pinecone_upsert("Step 1", "Description of Step 1")
```
Replace `YOUR_API_KEY` with your Pinecone API key and `YOUR_INDEX_NAME` with the name of your Pinecone index.
In this function, `step_description` is used both as the key and the value in the dictionary passed to the `client.upsert` method. This ensures that step_description will serve as the key in your Pinecone index, and the same value (step_description) will be associated with it.