delayedkarma/langchain-issues huggingface dataset:
raise ValueError(ALTERNATION_ERROR) ValueError: Error: Prompt must alternate between ' Human:' and ' Assistant:'.
Labels: name: auto:bug, name: area: models

### System Info

while trying to use BedrockChat , it threw my error below , the updated prompt which am using after the recent changes in claude prompt is below . 

        prompt_template = """
        Human: 
        You are a helpful, respectful, and honest assistant, dedicated to providing valuable and accurate information.
        Guidance for answers below
            Answer the question only using the in the context given below, and not with the prior knowledge.
            If you don't see answer in the context just Reply "Sorry , the answer is not in the context so I don't know".
        Now read this context and answer the question. 
        {context}
        Based on the provided context above and information from the retriever source, provide a detailed answer to the below question
        {question}
        If the information is not available in the context , respond with "don't know."

        Assistant:
        """

Error is below
    raise ValueError(ALTERNATION_ERROR)
ValueError: Error: Prompt must alternate between '
Human:' and '
Assistant:'.

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

        prompt_template = """
        Human: 
        You are a helpful, respectful, and honest assistant, dedicated to providing valuable and accurate information.
        Guidance for answers below
            Answer the question only using the in the context given below, and not with the prior knowledge.
            If you don't see answer in the context just Reply "Sorry , the answer is not in the context so I don't know".
        Now read this context and answer the question. 
        {context}
        Based on the provided context above and information from the retriever source, provide a detailed answer to the below question
        {question}
        If the information is not available in the context , respond with "don't know."

        Assistant:
        """

        modelId = 'anthropic.claude-v2' 

        # Langchain chain for invoking Endpoint
        llm = BedrockChat(
            model_id=modelId,
            client=bedrock_client,
            model_kwargs={"max_tokens_to_sample": 1000}
        )


### Expected behavior

I would have expected the code to run with the prompt.
Isolated python REPL based on docker containers 
Labels: name: auto:enhancement

## Description:

**This PR provides the ability to execute python code using `PythonREPLTool` tool inside a Docker container.** Isolated runs increase security by avoiding running malicious code generated by the model locally. 

This is made possible by introducing a new REPL called `PythonContainerREPL`, which is a wrapper around the Docker container that runs the Python code.

## Resolving Dependency Conflicts
Some checks failed due to a lack of added docker to the dependencies. Adding `docker` and updating `poetry.lock` caused a major merge conflict. We'd like to know how to go about adding Docker as an additional dependency in this case.

We would add docker to `pyproject.toml` as follows if it weren't for the difficult to resolve merge conflict of `poetry.lock`:
```
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
# Other dependencies...
docker = {version = "^6.1.3", optional = true}

[tool.poetry.extras]
docker = ["docker"]

Copy code
all = [
    "docker",
    # ... other packages ...
]
```

## Twitter handle:
@deepsense_ai
Add RunnableGenerator
Labels: name: auto:enhancement

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
improved content retrieval by adjusting _clean_data function
Labels: name: area: doc loader, name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** After some experimentation, I improved the _clean_data function in the ReadTheDocsLoader class. The old implementation would not constantly retrieve all of the text within the HTML document. A lot of times, the "page_content" would be empty. After searching the Discord channel for an answer, I decided to find the solution and am now pushing this implementation which will hopefully help others., 
  - **Issue:** N/A,
  - **Dependencies:** no new dependencies needed,
  - **Tag maintainer:** @baskaryan ,
  - **Twitter handle:** @istgus

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Issue: How can I fetch the response from Pinecone using namespace with similarity_search
Labels: name: area: vector store, name: auto:question, name: stale, name: integration: pinecone

### Issue you'd like to raise.

I fetch the result from pinecone using Pinecone's from_existing_index function.
My single Index contains multiple namespaces in pinecone. 
Now I have 2 cases:
1. I want to get the result of particular namespace. 
2. secondly I want to fetch the result from all the index's namespace.

How is it possible, Please Guide me accordingly? 

### Suggestion:

_No response_
Issue:  SQLDatabaseChain  fails to run when initialised with custom read only memory
Labels: name: area: memory, name: auto:bug, name: auto:question

### Issue you'd like to raise.

I have custom memory with memory key as 'context' as follows which i would like to use in the underling chain as readonly memory

 

```
memory = ScopeContextMemory(memory_key='context')
readonlymemory = ReadOnlySharedMemory(memory_key='context', memory=memory)
```

i have the following template stored in a file
```
Given an input question, first create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer.
Use the following format:

Question: "Question here"
SQLQuery: "SQL Query to run"
SQLResult: "Result of the SQLQuery"
Answer: "Final answer here"

Only use the following tables:
{table_info}

Use the following context for the query generation:
{context}
```

i have prompt initialised as follows
```
with open('prompts/sql_default_prompt.txt','r') as fp:
    DEFAULT_PROMPT = PromptTemplate(input_variables=['input','table_info','dialect', 'context'], 
                                          template=fp.read())
```

NOTE: 'context' is added as one of the input variable

Ive initialised SQL Database chain as follows

```
llm=OpenAI(temperature=0)

chain = SQLDatabaseChain.from_llm(llm=llm, 
                                  db=db, 
                                  verbose=True,
                                  use_query_checker=True, 
                                  prompt=DEFAULT_PROMPT,
                                  return_intermediate_steps=True, 
                                  memory=memory,
                                  top_k=3)
```


when i tried to run im getting an exception on missing input keys 'context' 

```
chain("List Items under the shopping cart for Davis")

---------------------------------------------------------------------------
ValueError  
    169 missing_keys = set(self.input_keys).difference(inputs)
    170 if missing_keys:
--> 171     raise ValueError(f"Missing some input keys: {missing_keys}")

ValueError: Missing some input keys: {'context'}
```






### Suggestion:

Ive tried looking at the documention on memory and its usage in chain , tools and agents but could not figure out what is going wrong here. any pointers on the cause is appreciated and how can i remediate the thing
Return output from map chain in the final result of ConversationalRetrievalChain.
Labels: name: auto:enhancement, name: area: models

### Feature request

Hi, 
I am working on Document QA, and using ConversationalRetrievalChain, with map-reduce as chain type. 
In the final result of ConversationalRetrievalChain, I want to get the individual output from each map-chain.


### Motivation

This is a separate issue, and I think there should be a parameter that we can pass, to get the output of these chains as well. 

### Your contribution

Not as of now.
Fix typo in gradient.ipynb
Labels: name: area: embeddings, name: auto:documentation

Enviroment -> Environment

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Chroma batching
Labels: name: area: vector store, name: auto:improvement, name: integration: chroma

 - **Description:** Chroma >= 0.4.10 added support for batch sizes validation of add/upsert. This batch size is dependent on the SQLite limits of the target system and varies. In this change, for Chroma>=0.4.10 batch splitting was added as the aforementioned validation is starting to surface in the Chroma community (users using LC)
 - **Issue:** N/A
 - **Dependencies:** N/A
 - **Tag maintainer:** @eyurtsev
 - **Twitter handle:** t_azarov
delete v1 tracer
Labels: name: auto:refactor

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
LangServe: Relax requirements
Labels: name: auto:nit

Relax requirements
<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Documents not being correctly indexed in vector database. ["redis.exceptions.ResponseError: my_docs: no such index"]
Labels: name: area: vector store, name: auto:bug, name: integration: redis

### System Info

Following the steps of indexing from [ https://python.langchain.com/docs/modules/data_connection/indexing ](url) you'll find the following error "redis.exceptions.ResponseError: my_docs: no such index".
You'll get this exception while using redis as retriever:
![Screenshot from 2023-09-28 16-57-03](https://github.com/langchain-ai/langchain/assets/81446007/afae536e-7888-4183-93d0-bfa65a8845a2)




### Who can help?

_No response_

### Information

- [x] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

![Screenshot from 2023-09-28 16-13-18](https://github.com/langchain-ai/langchain/assets/81446007/281206ed-b7c6-4b18-a3cc-25874fec7a06)
The error is here:
![Screenshot from 2023-09-28 16-32-00](https://github.com/langchain-ai/langchain/assets/81446007/f6bf52fb-d0ef-4f38-b247-475522bdfece)
If you look for the index you'll get (empty list or set).
This line makes impossible to save in the wanted format, and there's another thing: The index is not created for some reason.
I'll try to fix, but I'm not sure if it's possible for me at the moment, so I'm reporting this, I hope it helps.

### Expected behavior

Expected behavior inside Redis: "docs:indexname_:12ss2sadd"
Add a streaming json parser
Labels: name: auto:improvement


<img width="1728" alt="Screenshot 2023-09-28 at 20 15 01" src="https://github.com/langchain-ai/langchain/assets/56902/ed0644c3-6db7-41b9-9543-e34fce46d3e5">


<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Bedrock InvokeModel failes on GA release
Labels: name: auto:bug, name: area: models, name: integration: aws

### System Info

Lambda Python 3.11 runtime

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

As of Bedrock GA today, I get this error:

"/var/task/langchain/llms/bedrock.py", line 237, in _prepare_input_and_invoke raise ValueError(f"Error raised by bedrock service: {e}") ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModel operation: The requested operation is not recognized by the service. 


### Expected behavior

It should invoke the model. I'm guessing with today's GA release of Bedrock, an underlying API call changed.
Add source metadata to OutlookMessageLoader
Labels: name: lgtm, name: area: doc loader, name: auto:improvement

Description: Add "source" metadata to OutlookMessageLoader

This pull request adds the "source" metadata to the OutlookMessageLoader class in the load method. The "source" metadata is required when indexing with RecordManager in order to sync the index documents with a source.

Issue: None

Dependencies: None

Twitter handle: @ATelders
Add support for Bedrock cohere models
Labels: name: auto:improvement, name: stale, name: area: models

### Feature request

Bedrock added support for Cohere models and the Bedrock llm code must be updated with the right prompt formatting.

The prompt must be passed as `"prompt"` field and not as the code below does as `"input"`

```
{
  "modelId": "cohere.command-text-v14",
  "contentType": "application/json",
  "accept": "*/*",
  "body": {
    "prompt": "Write a LinkedIn post about starting a career in tech:",
    "max_tokens": 100,
    "temperature": 0.8,
    "return_likelihood": "GENERATION"   
  } 
}
```

https://github.com/langchain-ai/langchain/blob/44489e70291be95b5a95c2e0476f205202945778/libs/langchain/langchain/llms/bedrock.py#L71C1-L89C26

### Motivation

Getting support for all FM exposed by Bedrock via Langchain

### Your contribution

I can submit a PR
WebBaseLoader interprets incorrectly the web_path parameter
Labels: name: area: doc loader, name: auto:bug

### System Info

LangChain version: 0.0.304

### Who can help?

@eyurt

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [X] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```python
from langchain.document_loaders.web_base import WebBaseLoader
loader = WebBaseLoader("https://www.google.com")
docs = loader.load()
```

Result: RequestException is raised with the message "Invalid URL 'h': No scheme supplied. Perhaps you meant https://h?"

### Expected behavior

The page contents correctly loads to documents.
Add safe pandas eval tool
Labels: name: area: agent, name: auto:enhancement

- [ ] whitelist FROM clause to only allow selecting from the names of the data frames passed in or subqueries (which are themselves subject to same whitelisting)

<img width="1264" alt="Screenshot 2023-10-03 at 13 31 57" src="https://github.com/langchain-ai/langchain/assets/56902/33f460d0-353c-4d27-9f3b-9b4912f194e9">


<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Enable creating Tools from any Runnable
Labels: name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->