delayedkarma/langchain-issues huggingface dataset:
Stop sequences in fireworks, plus notebook updates
Labels: name: auto:improvement, name: area: models

The new Fireworks and FireworksChat implementations are awesome! Added in this PR https://github.com/langchain-ai/langchain/pull/11117 thank you @ZixinYang 

However, I think stop words were not plumbed correctly. I've made some simple changes to do that, and also updated the notebook to be a bit clearer with what's needed to use both new models.

Tagging model maintainer @baskaryan
Add pending deprecation warning
Labels: name: auto:improvement

This PR  uses 2 dedicated LangChain warnings types for deprecations (mirroring python's built in deprecation and pending deprecation warnings). 

These deprecation types are unslienced during initialization in langchain achieving the same default behavior that we have with our current warnings approach. However, because these warnings have a dedicated type, users will be able to silence them selectively (I think this is strictly better than our current handling of warnings).

The PR adds a deprecation warning to llm symbolic math.
ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModel operation: Invalid prompt: prompt must start with "  Human:" turn, prompt must end with "  Assistant:" turn
Labels: name: area: embeddings, name: auto:bug, name: area: models

### System Info

Langchain version = 0.0.231
python = 3.10

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

    from langchain.llms import Bedrock
    model_kwargs={"max_tokens_to_sample":8000}
    resp = Bedrock(credentials_profile_name="default",
        model_id="anthropic.claude-v2",model_kwargs={"max_tokens_to_sample":8000})

### Expected behavior

this same piece of code used to work just fine in the past weeks , now it's causing a prompt error 
i'm sure that bedrock changed something on their end
Add scoring chain
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.
 -->
Feature: LLM Vertex AI metadata support
Labels: name: auto:enhancement, name: stale, name: area: models

### Feature request

The Google Cloud community would love to enjoy the full capabilities of Vertex AI models on top of Langchain. To this end, we would be able to access the metadata fields ([reference](https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/text#response_body)) as outputs of the Vertex AI LLM model in Langchain, indicating crucial information such as the number of input and output tokens, and number of billed characters.

### Motivation

This feature is already available on the OpenAI model as part of the [LLM output field](https://api.python.langchain.com/en/latest/schema/langchain.schema.output.LLMResult.html#langchain.schema.output.LLMResult.llm_output). For the Vertex AI model, it simply outputs a None value. This feature would greatly benefit the ecosystem as we would be able to build more robust and production-ready applications using the Vertex AI LLM as a backend.

### Your contribution

I am currently looking into implementing it myself. PR to be opened soon.
[Feat] Add optional client-side encryption to DynamoDB chat history memory
Labels: name: area: memory, name: lgtm, name: auto:enhancement, name: integration: aws

**Description:** Added optional client-side encryption to the Amazon DynamoDB chat history memory with an AWS KMS Key ID using the [AWS Database Encryption SDK for Python](https://docs.aws.amazon.com/database-encryption-sdk/latest/devguide/python.html) 
**Issue:** #7886
**Dependencies:** [dynamodb-encryption-sdk](https://pypi.org/project/dynamodb-encryption-sdk/)
**Tag maintainer:**  @hwchase17 
**Twitter handle:** [@jplock](https://twitter.com/jplock/)
Issue: Integrating QA prompt with MultiRetrievalQAChain 
Labels: name: auto:bug, name: stale, name: area: models


I am using `"langchain": "^0.0.89"`  to use the _**MultiRetrievalQAChain**_.  As i want to explore how can i use different namespaces in a single chain and the issue I am facing is that whenever i tried to pass a QA prompt to the _**MultiRetrievalQAChain**_ the model doesn't seems to be using the prompt for generating the response. I have tried multiple options but this does not seems to be working.

Here is the code snippets:

- This is the first option I tried
```
const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
    llm,
    {
      retrieverNames,
      retrieverDescriptions,
      retrievers,
      retrieverPrompts: [
        QA_PROMPT,
        QA_PROMPT,
        QA_PROMPT,
      ],
      retrievalQAChainOpts: {
        returnSourceDocuments: true,
      },
    }
  );
```

- Here is the second option I explore:

```
 const multiRetrievalQAChain = MultiRetrievalQAChain.fromLLMAndRetrievers(
    llm,
    {
      retrieverNames,
      retrieverDescriptions,
      retrievers,
      retrievalQAChainOpts: {
        returnSourceDocuments: true,
       prompt:QA_PROMPT

      },
    }
  );
```




### Suggestion:

Please give some code or **_langchain_**  references for suggestion. Helping in advance
auto escape stop sequences in 'enforce_stop_tokens' helper function
Labels: name: auto:bug, name: area: models

**Description**

I've noticed that the split function interprets the inputs as regex expressions, which can sometimes lead to unexpected behaviour.

For instance: the LLM implementation can pass stop parameters to the appropriate model (or inference API) and then it will call the `enforce_stop_tokens` function to be 100% sure that there is no extra text after the stop sequence has been reached.

So where is the problem?
If you pass `stop=["."]`, the API will interpret the stop sequences as is, but the helper function interprets the `.` as regex matching any character yielding in an empty result.

Tag maintainer:
@hwchase17
@baskaryan
[Feat] Add ChatModel, LLM, and Embeddings for ERNIE Bot APIs 
Labels: name: auto:enhancement, name: area: models

  - **Description:** 
      - Add `langchain.llms.ERNIEBot` for text completion.
      - Add `langchain.chat_models.ChatERNIEBot` for chat completion.
      - Add `langchain.embeddings.ERNIEBotEmbeddings` for sentence embeddings.
      - Integration tests and example notebooks on the new features are included in this PR, too.
  - **Issue:** None.
  - **Dependencies:** 
      - `erniebot`
  - **Tag maintainer:** @baskaryan 
  - **Twitter handle:** None.

## Differences from the existing integrations

In #9114 , #9370 , and #10496 , several integrations have been contributed to LangChain, all claiming to support Baidu's ERNIE Bot (文心一言) large language models. Taking chat models as an example, currently we have two similar chat models in LangChain to interact with ERNIE Bot APIs: `langchain.chat_models.ErnieBotChat` and `langchain.chat_models.QianfanChatEndpoint`. This pull request, however, is going to add a third one, `langchain.chat_models.ERNIEBotChat`. Here is a clarification on how the new integrations introduced in this PR differ from the existing ones.

1. The integrations introduced in this PR are enhancements to those introduced in #9114 and #9310 in the following aspects:

- The new integrations are implemented based on the official [ERNIE Bot Python SDK](https://github.com/PaddlePaddle/ERNIE-Bot-SDK), which provides additional safety and robustness, whereas the existing ones are implemeneted with raw `request` APIs.
- A new LLM, `langchain.llms.ERNIEBot`, is introduced for text completion.
- More advanced features are supported, e.g. asynchronous calling, streaming, function calling.
- More examples are added in three Jupyter Notebooks, including the examples on the usage of the advanced features.

2. The new integrations provide a way for [AI Studio](https://aistudio.baidu.com/index) users to access the ERNIE Bot APIs in LangChain, while for users of the Qianfan platform, the integrations introduced in #10496 should be the right choice.

3. The new integrations do not support the models in #10024 , as these models are not strictly ERNIE Bot models, and including them in `langchain.chat_models.ErnieBotChat` can make users confused. What's more, the `langchain.chat_models.QianfanChatEndpoint` contributed in #10496 already provides access to these models, and it is not necessary to include them again in another integration.
feat: support ChatModels Qianfan `QianfanChatEndpoint` function_call
Labels: name: auto:enhancement, name: area: models

- **Description:** 
    * feature for `QianfanChatEndpoint` function_call ability, add integration_test for it
    * add `model`, `endpoint` supported in calling params
    * add raw response in ChatModel Message
- **Issue:** 
    * #10867 
    * #11105 
    * #10215
- **Dependencies:** no
- **Tag maintainer:** @baskaryan 
- **Twitter handle:** no
Feature: `QianfanChatEndpoint` Support function_call
Labels: name: auto:enhancement, name: stale, name: area: models

### Feature request

- `QianfanChatEndpoint` Or `ErnieBotChat` support function calling

### Motivation

Neither `QianfanChatEndpoint` and `ErnieBotChat` supported ERNIE-Bot Function ability now. We need this for developing agent by function_call where is only supported by openai function_call AFAIK.

### Your contribution

ready to PR
Hrisikesh/router
Labels: name: area: vector store, name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** Added multi-type destination chains class to support different types of chains ( including custom chains) which might not be LLM chains. , 
  - **Issue:** It adds support for multiple types of destination chains (e.g. QA chains, summarize chains or custom chains),
  - **Dependencies:** No any specific,
  - **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.
 -->
DOC: No module named 'langchain.tools.render'
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

In the tutorial of using agent, link here: https://python.langchain.com/docs/modules/agents/ . The given codes are `from langchain.tools.render import format_tool_to_openai_function`, which leads to the error `ModuleNotFoundError: No module named 'langchain.tools.render'`

### Idea or request for content:

I suppose the code should be changed to `from langchain.tools import format_tool_to_openai_function`
Issue: break change?
Labels: name: auto:bug

### Issue you'd like to raise.

version: 0.0.39
issus:
```
Traceback (most recent call last):
  File "xxxxxxxx/langchain/main.py", line 8, in <module>
    prompt = PromptTemplate.from_template(template) 
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'PromptTemplate' has no attribute 'from_template'
```

Is that a BC?


### Suggestion:

_No response_
MultiVector Retriever: KeyError: 'doc_id'
Labels: name: area: memory, name: area: doc loader, name: area: vector store, name: auto:bug

### System Info

**System Info** 

Using Lanchain version 0.0.301
Python 3.11.3
MS Windows 10 Enterprise


### Who can help?

**Who can help?**

@hwchase17 @eyurtsev @agola11

### 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
- [X] Vector Stores / Retrievers
- [X] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [X] Callbacks/Tracing
- [ ] Async

### Reproduction

I used the same code from https://python.langchain.com/docs/modules/data_connection/retrievers/multi_vector

The only difference is that I used the below code for the loaders

![image](https://github.com/langchain-ai/langchain/assets/67390957/5318213a-e07d-417a-9934-691f0325d12a)

And the execution code is:

![image](https://github.com/langchain-ai/langchain/assets/67390957/7782b7fa-0e9f-4b99-a841-63a21b374d88)

The rest of the code is from the MultiVector Retriever. I used two PDF documents which are of 16 and 18 pages respectively. 




### Expected behavior

The expectation is when I ask a question that requires the MultiVector to retrieve vectors from both documents and collate an answer together - which it does. But sometimes, for some questions I get the following error

![image](https://github.com/langchain-ai/langchain/assets/67390957/de6bd479-d6f2-44ec-93a2-076cdb92e122)

I have checked previously - 'doc_id' is present from the steps followed in the documentation. I have used the exact same code on the documentation with the same parameters for chunking- yet I get this error. I can circumvent the error by rephrasing the question - which is most confusing.  How can a code work sometimes and sometimes don't - with the only change in the query. The length of the query doesn't seem to matter from my analysis. Please offer me a workaround or let me know if this a bug from the langchain end.
DOC: Connecting Langchain to Microsoft SharePoint
Labels: name: area: doc loader, name: auto:documentation, name: stale

### Issue with current documentation:

Under the https://python.langchain.com/docs/integrations/document_loaders/microsoft_sharepoint page - in step 10 the URL is wrong to obtain the Edm.guid property.

The correct URL is https://<tenant>.sharepoint.com/sites/<site-name>/_api/web/id





### Idea or request for content:

Please update the current documentation after checking the proposed change.
web_base loader is broken 
Labels: name: area: doc loader, name: auto:bug, name: auto:documentation, name: stale

### System Info

Name: langchain
Version: 0.0.299


### Who can help?

@eyurtsev @hwchase17 

### 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

Just follow https://python.langchain.com/docs/integrations/document_loaders/web_base

```
from langchain.document_loaders import WebBaseLoader
loader = WebBaseLoader("https://www.espn.com/")
data = loader.load()
```

### Expected behavior

The standard WebLoader is broken when we pass webpath as described in the [docs](https://python.langchain.com/docs/integrations/document_loaders/web_base) as 
`loader = WebBaseLoader("https://www.espn.com/")`

However it workes if we pass as
`loader = WebBaseLoader(["https://www.espn.com/"])`

The reason for that is [this commit](https://github.com/langchain-ai/langchain/commit/097ecef06bbc51ae21e134af4dfbb4ebe4902f3a)

Also because of this breaking change the other Custom Web Loaders  are broken as well IMSDbLoader, AZLyricsLoader, and CollegeConfidentialLoader
Added prompt wrapping for Claude with Bedrock
Labels: name: auto:bug, name: area: models, name: integration: aws

  - **Description:** Prompt wrapping requirements have been implemented on the service side of AWS Bedrock for the Anthropic Claude models to provide parity between Anthropic's offering and Bedrock's offering. This overnight change broke most existing implementations of Claude, Bedrock and Langchain. This PR just steals the the Anthropic LLM implementation to enforce alias/role wrapping and implements it in the existing mechanism for building the request body. This has also been tested to fix the chat_model implementation as well. Happy to answer any further questions or make changes where necessary to get things patched and up to PyPi ASAP, TY.
  - **Issue:** No issue opened at the moment, though will update when these roll in.
  - **Dependencies:** None
DOC: Python Documentation has a broken link in the "Memory in Agent" page

### Issue with current documentation:

The broken link in question: https://python.langchain.com/docs/modules/memory/how_to/adding_memory.html

The offending hyperlink:
![image](https://github.com/langchain-ai/langchain/assets/16566003/4151cf9a-174d-48f4-94a0-15bb051cf94d)

The page where the above is found: https://python.langchain.com/docs/modules/memory/agent_with_memory

### Idea or request for content:

_No response_
Validation errors for SQLDatabaseSequentialChain
Labels: name: area: agent, name: auto:bug, name: stale, name: area: models

### System Info

![image](https://github.com/langchain-ai/langchain/assets/9436757/3e5a6899-c01f-45ef-9458-942d69f3fe38)
My Langchain is upto date and credentials are also perfectly fine. 
I am importing SQLDatabaseSequentialChain from langchain_experimental.sql package

Still I am getting the following error. Any support would be definitely helpful.

### Who can help?

@eyurtsev @agola11

### Information

- [X] 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
- [X] Agents / Agent Executors
- [X] Tools / Toolkits
- [X] Chains
- [X] Callbacks/Tracing
- [ ] Async

### Reproduction

!pip install langchain==0.0.302
!pip install --user --upgrade langchain.experimental

### Expected behavior

This statement will not generate any output but it will execute without any error. Now its giving me error
Change type annotations from LLMChain to Chain in MultiPromptChain
Labels: name: auto:bug, name: area: models

- **Description:** The types of 'destination_chains' and 'default_chain' in 'MultiPromptChain' were changed from 'LLMChain' to 'Chain'. and removed variables declared overlapping with the parent class
- **Issue:** When a class that inherits only Chain and not LLMChain, such as 'SequentialChain' or 'RetrievalQA', is entered in 'destination_chains' and 'default_chain', a pydantic validation error is raised.
-  -  codes
```
retrieval_chain = ConversationalRetrievalChain(
        retriever=doc_retriever,
        combine_docs_chain=combine_docs_chain,
        question_generator=question_gen_chain,
    )
    
    destination_chains = {
        'retrieval': retrieval_chain,
    }
    
    main_chain = MultiPromptChain(
        router_chain=router_chain,
        destination_chains=destination_chains,
        default_chain=default_chain,
        verbose=True,
    )
```
-  -  error log
```
  File "/Users/aimmo-aip-0170/Library/Caches/pypoetry/virtualenvs/aimmo-slack-chatbot-XJShztsB-py3.9/lib/python3.9/site-packages/langchain/load/serializable.py", line 75, in __init__
    super().__init__(**kwargs)
  File "/Users/aimmo-aip-0170/Library/Caches/pypoetry/virtualenvs/aimmo-slack-chatbot-XJShztsB-py3.9/lib/python3.9/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 10 validation errors for MultiPromptChain
destination_chains -> retrieval -> prompt
  field required (type=value_error.missing)
destination_chains -> retrieval -> llm
  field required (type=value_error.missing)
destination_chains -> retrieval -> combine_docs_chain
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> get_chat_history
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> max_tokens_limit
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> question_generator
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> rephrase_question
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> retriever
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> return_generated_question
  extra fields not permitted (type=value_error.extra)
destination_chains -> retrieval -> return_source_documents
  extra fields not permitted (type=value_error.extra)
```
  - **Tag maintainer:** @hwchase17 


✅ `make format`, `make lint` and `make test`
Add optional Cypher validation tool
Labels: name: auto:improvement, name: area: models

LLMs have trouble with consistently getting the relationship direction accurately. That's why I organized a competition how to best and most simple to fix it based on the existing schema as a post-processing step. https://github.com/tomasonjo/cypher-direction-competition

I am adding the winner's code in this PR: https://github.com/sakusaku-rich/cypher-direction-competition