delayedkarma/langchain-issues huggingface dataset:
when I run the demo from the cookbook，I get error Error code: 404 - {'error': {'message': 'The model `text-davinci-003` does not exist1', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
Labels: name: auto:bug, name: area: models

### System Info

Python 3.10.10 langchain@0.0.342
langchain-core@ 0.0.7

### Who can help?

_No response_

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

### Reproduction

md_file = docs[0].page_content
headers_to_split_on = [
    ("###", "Section"),
]
markdown_splitter = MarkdownHeaderTextSplitter(headers_to_split_on=headers_to_split_on)
md_header_splits = markdown_splitter.split_text(md_file)
chunk_size = 500
chunk_overlap = 0
text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=chunk_size, chunk_overlap=chunk_overlap
)
all_splits = text_splitter.split_documents(md_header_splits)
vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings())

metadata_field_info = [
    AttributeInfo(
        name="Section",
        description="Part of the document that the text comes from",
        type="string or list[string]",
    ),
]
document_content_description = "Major sections of the document"

# Define self query retriever
llm = OpenAI(temperature=0)
retriever = SelfQueryRetriever.from_llm(
    llm, vectorstore, document_content_description, metadata_field_info, verbose=True
)
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)
qa_chain = RetrievalQA.from_chain_type(llm, retriever=retriever)
qa_chain.run("衰老有哪些因素？")

### Expected behavior

how can I fix the problem
Improve HyDe with custom prompts and ability to supply the run_manager
Labels: name: auto:improvement, name: size:S

  - **Description:** The class allows to only select between a few predefined prompts from the paper. That is not ideal, since other use cases might need a custom prompt. The changes made allow for this. To be able to monitor those, I also added functionality to supply a custom run_manager.
  - **Issue:** no issue, but a new feature,
  - **Dependencies:** none,
  - **Tag maintainer:** @hwchase17,
  - **Twitter handle:** @yvesloy
Issue: how to increase the conversation chain response length?
Labels: name: auto:question, name: area: models

### Issue you'd like to raise.

When I call Llam2-70b-chat model using conversation chain, I got very short response from the model. But if I use LLMChain to call the model, it can give me a long response. So, is there any thing cut off or limit the response length in conversation chain?  The model parameter about max_new_tokens I set as 4096, so I don't think that is caused by the model.
<img width="1589" alt="截屏2023-11-29 15 47 33" src="https://github.com/langchain-ai/langchain/assets/27841780/34eb62c5-ce1f-4296-9ff8-6298c0c031d6">


### Suggestion:

_No response_
UserWarning: WARNING! repetition_penalty is not default parameter.
Labels: name: auto:question, name: area: models

### Issue you'd like to raise.

Hi,

I am using Langchain and LlamaCpp to load my models. 
I have set "`mirostat`" and "`repitition_penalty`" in my model params and recently I am getting the following UserWarning:
```
UserWarning: WARNING! repetition_penalty is not default parameter.
                repetition_penalty was transferred to model_kwargs.
                Please confirm that repetition_penalty is what you intended.
```
and
```
UserWarning: WARNING! mirostat is not default parameter.
                mirostat was transferred to model_kwargs.
                Please confirm that mirostat is what you intended.
```

Here is my code: 
```
import box
import yaml
from langchain.llms import LlamaCpp
from langchain.callbacks.manager import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler

def build_llm(model_path):
        callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])

        n_gpu_layers = 1  # Metal set to 1 is enough.
        n_batch = 512  # Should be between 1 and n_ctx, consider the amount of RAM of your Apple Silicon Chip.
        
        if model_path == "/Users/mweissenba001/Documents/llama2/llama.cpp/models/7B/ggml-model-q4_0.bin":
                context_size = 4000
        if model_path == "/Users/mweissenba001/Documents/rag_example/Modelle/llama-2-13b-german-assistant-v2.Q5_K_M.gguf":
                context_size = 4000
        else:
                context_size = 7000

        llm = LlamaCpp(
                max_tokens =cfg.MAX_TOKENS,
                model_path=model_path,
                temperature=cfg.TEMPERATURE,
                f16_kv=True,
                n_ctx=context_size, # 8k aber mann muss Platz lassen für Instruction, History etc. 
                n_gpu_layers=n_gpu_layers,
                n_batch=n_batch,
                callback_manager=callback_manager, 
                verbose=True, # Verbose is required to pass to the callback manager
                top_p=0.75,
                top_k=40,
                repetition_penalty=1.1,
                mirostat = 2,
        )
        
        return llm

llm = build_llm(model_path)
```

My current Langchain Version is: 
`langchain-0.0.339` 
Upgrading to `langchain-0.0.341` didn't help.

So what do I have to do to prevent the warnings? Where in model_kwargs to I have to set mirostat and repitition_penalty?

### Suggestion:

_No response_
Mask API key for ForeFrontAI LLM
Labels: name: lgtm, name: auto:improvement, name: area: models, name: size:M

  - **Description:** Mask API key for ForeFrontAI LLM and associated unit tests
  - **Issue:** https://github.com/langchain-ai/langchain/issues/12165
  - **Dependencies:** N/A
  - **Tag maintainer:** @eyurtsev 
  - **Twitter handle:** `__mmahmad__`

I made the API key non-optional since linting required adding validation for None, but the key is required per documentation: https://python.langchain.com/docs/integrations/llms/forefrontai
Added Slacktoolkit
Labels: name: area: agent, name: lgtm, name: auto:enhancement, name: size:L

  - **Description:** 
This PR introduces the Slack toolkit to LangChain, which allows users to read and write to Slack using the Slack API. Specifically, we've added the following tools.
1. get_channel: Provides a summary of all the channels in a workspace.
2. get_message: Gets the message history of a channel.
3. send_message: Sends a message to a channel.
4. schedule_message: Sends a message to a channel at a specific time and date.

  - **Issue:** This pull request addresses [Add Slack Toolkit #11747](https://github.com/langchain-ai/langchain/issues/11747)
  - **Dependencies:** package`slack_sdk`
  Note: For this toolkit to function you will need to add a Slack app to your workspace. Additional info can be found [here](https://slack.com/help/articles/202035138-Add-apps-to-your-Slack-workspace).
Update MLflow and Databricks docs
Labels: name: auto:documentation, name: size:L

<!-- 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/langchain-ai/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.
 -->

Depends on #13699. Updates the existing mlflow and databricks examples.
Ziqian/doc intelligence
Labels: name: area: doc loader, name: auto:enhancement, name: size:L

  - **Description:**
 Add DocumentIntelligenceLoader & DocumentIntelligenceParser implementation using the latest Azure Document Intelligence SDK with markdown support.
The core logic resides in DocumentIntelligenceParser and DocumentIntelligenceLoader is a mere wrapper of the parser.
The parser will takes api_endpoint and api_key and creates DocumentIntelligenceClient for the user. 4 parsing modes are supported:
1. Markdown (default)
2. Single
3. Page 
4. Object

UT and notebook are also updated accordingly.

  - **Dependencies:** Azure Document Intelligence SDK: azure-ai-documentintelligence [azure-sdk-for-python/sdk/documentintelligence/azure-ai-documentintelligence at 7c42462ac662522a6fd21b17d2a20f4cd40d0356 · Azure/azure-sdk-for-python (github.com)](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sdk-for-python%2Ftree%2F7c42462ac662522a6fd21b17d2a20f4cd40d0356%2Fsdk%2Fdocumentintelligence%2Fazure-ai-documentintelligence&data=05%7C01%7CZifei.Qian%40microsoft.com%7C298225aa3e31468a863108dbf07374ff%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638368150928704292%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oE0Sl4HERnMKdbkV9KgBV46Z2xytcQAShdTWf7ZNl%2Bs%3D&reserved=0).
Add: Steam API tool
Labels: name: area: agent, name: auto:enhancement, name: size:L

  - **Description:** Our PR is an integration of a Steam API Tool that makes recommendations on steam games based on user's Steam profile and provides information on games based on user provided queries.
  - **Issue:** the issue # our PR implements: https://github.com/langchain-ai/langchain/issues/12120
  - **Dependencies:** python-steam-api library, steamspypi library and decouple library
  - **Tag maintainer:** @baskaryan, @hwchase17 
  - **Twitter handle:** N/A

Hello langchain Maintainers,

We are a team of 4 University of Toronto students contributing to langchain as part of our course [CSCD01 (link to course page)](https://cscd01.com/work/open-source-project). We hope our changes help the community. We have run make format, make lint and make test locally before submitting the PR. To our knowledge, our changes do not introduce any new errors.

Our PR integrates the python-steam-api, steamspypi and decouple packages. We have added integration tests to test our python API integration into langchain and an example notebook is also provided.

Our amazing team that contributed to this PR: @JohnY2002, @shenceyang, @andrewqian2001 and @muntaqamahmood  

Thank you in advance to all the maintainers for reviewing our PR!
add validation error handler to `BaseTool`
Labels: name: auto:improvement, name: size:L

<!-- 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/langchain-ai/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.
 -->

- **Description:**  add a ValidationError handler as a field of [`BaseTool`](https://github.com/langchain-ai/langchain/blob/master/libs/core/langchain_core/tools.py#L101) and add unit tests for the code change.
- **Issue:** #12721 #13662
- **Dependencies:** None
- **Tag maintainer:** 
- **Twitter handle:** @hmdev3
- **NOTE:**
  - I'm wondering if the update of document is required.
doc: update langchain version for mongodb integration
Labels: name: lgtm, name: area: doc loader, name: auto:documentation, name: size:XS

- **Description:** update minimal supported langchain version for [mongodb atlast integration webpage](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas)
- **Issue:** none
- **Dependencies:** none

-----

Just fixing a typo. 
In [mongodb atlas vectorstore integration page](https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas), `langchain` support for `$vectorSearch MQL stage` should be `0.0.305` rather than `0.0.35`
Improve file system blob loader and generic loader
Labels: name: area: doc loader, name: auto:improvement, name: size:L

* Add support for passing a specific file to the file system blob loader
* Allow specifying a class parameter for the parser for the generic loader

```python

class AudioLoader(GenericLoader):
  @staticmethod
  def get_parser(**kwargs):
     return MyAudioParser(**kwargs):
```

The intent of the GenericLoader is to provide on-ramps from different sources (e.g., web, s3, file system).

An alternative is to use pipelining syntax or creating a Pipeline

```
FileSystemBlobLoader(...) | MyAudioParser
```
`Rephrase and Respond`
Labels: name: auto:enhancement, name: auto:documentation, name: area: models

### Feature request

[Rephrase and Respond: Let Large Language Models Ask Better Questions for Themselves](https://arxiv.org/abs/2311.04205) 
",,,RaR is complementary to CoT and can be combined with CoT to achieve even better performance,,,"
- interesting prompt technique.
Could be implemented with LangChain.

### Motivation

to make LangChain more powerful?

### Your contribution

I can help with documentation
Adding new StackExchange API integration
Labels: name: lgtm, name: auto:enhancement, name: size:L

Implements [#12115](https://github.com/langchain-ai/langchain/issues/12115) 

Who can review?
@baskaryan , @eyurtsev , @hwchase17 

Integrated Stack Exchange API into Langchain, enabling access to diverse communities within the platform. This addition enhances Langchain's capabilities by allowing users to query Stack Exchange for specialized information and engage in discussions. The integration provides seamless interaction with Stack Exchange content, offering content from varied knowledge repositories.

A notebook example and test cases were included to demonstrate the functionality and reliability of this integration.

- Add StackExchange as a tool.
- Add unit test for the StackExchange wrapper and tool.
- Add documentation for the StackExchange wrapper and tool.

If you have time, could you please review the code and provide any feedback as necessary! My team is welcome to any suggestions.
New model parameters and dynamic batching for VertexAIEmbeddings
Labels: name: area: embeddings, name: auto:improvement, name: size:L

  - **Description:** VertexAIEmbeddings performance improvements
  - **Twitter handle:** @vladkol

## Improvements

- Dynamic batch size, starting from 250, lowering down to 5. Batch size varies across regions.
Some regions support larger batches, and it significantly improves performance.
When running large batches of texts in `us-central1`, performance gain can be up to 3.5x.
The dynamic batching also makes sure every batch is below 20K token limit.
- New model parameter `embeddings_type` that translates to `task_type` parameter of the API. Newer model versions support [different embeddings task types](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings#api_changes_to_models_released_on_or_after_august_2023).
Adding Initial Support for NVIDIA AI Playground LLMs
Labels: name: auto:enhancement, name: area: models, name: size:XS

  - **Description:** Added NVIDIA AI Playground Initial support for a selection of models (Llama models, Mistral, etc.)
  - **Dependencies:** These models do depend on the AI Playground services in NVIDIA NGC. API keys with a significant amount of trial compute are available (10K queries as of the time of writing).

- Some additional tests can be ran in [this colab notebook](https://colab.research.google.com/drive/1I2xcp8Mq1x36BizAlzRCYDsEbCiQqRBL#revisionId=0B3KSICnsqLpGNHJVWTlVN1E4YkZyR3JLNG1yOG8xUDVkU0VvPQ)
- [A quick link to get a key](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/ai-foundation/models/codellama-13b/api) when you have an NGC account. Generate Key button at the top right of the code window.

Thanks so much for the help, and please let me know if you need anything :D
DOC: streamlit memory parameters - memory_key and chat_history
Labels: name: area: memory, name: auto:bug, name: auto:documentation

### Issue with current documentation:

Streamlit tutorial suggests
```
from langchain.memory import ConversationBufferMemory
from langchain.memory.chat_message_histories import StreamlitChatMessageHistory

# Optionally, specify your own session_state key for storing messages
msgs = StreamlitChatMessageHistory(key="special_app_key")

memory = ConversationBufferMemory(memory_key="history", chat_memory=msgs)
if len(msgs.messages) == 0:
    msgs.add_ai_message("How can I help you?")
```

but in version 0.340, definition of ConversationBufferMemory only includes parameter memory_key but not chat_history.

I have noticed my model outputs being less accurate for the same script when streamlit is incorporated and I suspect this is the issue.

### Idea or request for content:

Please clarify how to best implement Streamlit with chat history.
SQLDatabaseChain returning Question and SQL Query instead of answer
Labels: name: auto:bug, name: area: models

### System Info

Code


db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, return_sql=False, use_query_checker=True, prompt=prompt_template)
db_chain.run("What are some recently added dockets and their title?")

Verbose
> Entering new SQLDatabaseChain chain...
What are some recently added dockets and their title?
SQLQuery:SELECT id, title, modifyDate FROM docket ORDER BY modifyDate DESC LIMIT 5;
SQLResult: [('CMS-2023-0184', 'CY 2024 Inpatient Hospital Deductible and Hospital and Extended Care Services Coinsurance Amounts.  CMS-8083-N', datetime.datetime(2023, 11, 1, 15, 34, 1)), ('CMS-2023-0183', '(CMS-10143)  State Data for  the Medicare Modernization Act (MMA)', datetime.datetime(2023, 11, 1, 10, 34, 24)), ('CMS-2023-0181', 'CHIP State Plan Eligibility (CMS-10398 #17)', datetime.datetime(2023, 11, 1, 10, 25, 35)), ('CMS-2023-0182', '(CMS-10434 #77) Medicaid and Continuous  Eligibility for Children', datetime.datetime(2023, 11, 1, 10, 24, 56)), ('CMS-2023-0180', 'Virtual Groups for Merit Based Incentive Payment System (MIPS) (CMS-10652)', datetime.datetime(2023, 10, 31, 13, 8, 24))]
Answer:SELECT id, title, modifyDate FROM docket ORDER BY modifyDate DESC LIMIT 5;
> Finished chain.

Output:
'SELECT id, title, modifyDate FROM docket ORDER BY modifyDate DESC LIMIT 5;'

The chain is not returning the SQLResult in the chat format even though the query is executed correctly.

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

### Reproduction

prompt_suffix = """
If asked for recent dockets, give 5 most recent ones.
Make sure the table name is in the database.

Table name: docket,
Use only these columns when selecting: id, title, modifyDate
"""

prompt_template = PromptTemplate.from_template(prompt_suffix)

db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, return_sql=False, use_query_checker=True, prompt=prompt_template)
db_chain.run("What are some recently added dockets and their title?")

### Expected behavior

Example output:

The recently added dockets with their dates are:\n\n* CMS-2023-0181 - CY 2024 Inpatient Hospital Deductible and Hospital and Extended Care Services Coinsurance Amounts (November 1st, 2023'
Add MongoDB database agent
Labels: name: area: agent, name: auto:enhancement, name: size:XXL

<!-- 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/langchain-ai/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.
 -->

**Description:** Created an agent designed to interact with and query a `MongoDB` database using PyMongo. The agent is very similar to [SQL Database](https://python.langchain.com/docs/integrations/toolkits/sql_database). Currently, it only supports one database per instance `MongoDatabase` class using URI, and the database name must be appended to the end of the URI. 

See `docs/docs/integrations/toolkits/mongo_database.ipynb` for an example of usage.

**Note:** To run PyMongo queries, it checks the input string using regex that it follows the `db.collection.find ...` format and runs it using `eval()`, which is bad practice and may be dangerous (if anyone finds a better solution, feel free change that). Additionally, the tests pass locally due to having MongoDB installed since the tests use the `tmp/mongodb-27017.sock` Unix socket, but do not pass Github Actions test workflows for the same reason, and since we weren't sure whether it would be good practice to edit the workflow and haven't figured out a good way to mock PyMongo's MongoClient/Database that isn't unnecessarily complex or makes the unit tests superficial, we left it as is. 

**Issue:** Closes [Connection with mongo db #3399](https://github.com/langchain-ai/langchain/issues/3399)
**Dependencies:** pymongo (dependency already existed, but changed from optional to not)
Audio file loader implemented with Azure speech service
Labels: name: area: doc loader, name: auto:enhancement, name: size:L

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** Audio file loader implemented with Azure speech service
  - **Issue:** No,
  - **Dependencies:** azure-cognitiveservices-speech,
  - **Tag maintainer:** kzmain (see below),
  - **Twitter handle:** @kzmain (Same id as the github)