delayedkarma/langchain-issues huggingface dataset:
feat: Add `UnstructuredCSVLoader` for CSV files

### Summary

Adds an `UnstructuredCSVLoader` for loading CSVs. One advantage of using `UnstructuredCSVLoader` relative to the standard `CSVLoader` is that if you use `UnstructuredCSVLoader` in `"elements"` mode, an HTML representation of the table will be available in the metadata.

#### Who can review?

@hwchase17
 @eyurtsev
API Chains

### System Info

from langchain.chains import APIChain

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

### Reproduction

```
from langchain.chains.api.prompt import API_RESPONSE_PROMPT
from langchain.chains import APIChain
from langchain.prompts.prompt import PromptTemplate
from langchain.llms import OpenAI

llm = OpenAI(temperature=0)
from langchain.chains.api import open_meteo_docs
chain_new = APIChain.from_llm_and_api_docs(llm, open_meteo_docs.OPEN_METEO_DOCS, verbose=True)
```

ERROR: chain_new.run('What is the weather like right now in Munich, Germany in degrees Fahrenheit?')
> Entering new APIChain chain...
---------------------------------------------------------------------------
AuthenticationError                       Traceback (most recent call last)
Cell In[32], line 1
----> 1 chain_new.run('What is the weather like right now in Munich, Germany in degrees Fahrenheit?')

File [~\AppData\Roaming\Python\Python311\site-packages\langchain\chains\base.py:256](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/lstewart/OneDrive/AI%20STUFF/Eternal/~/AppData/Roaming/Python/Python311/site-packages/langchain/chains/base.py:256), in Chain.run(self, callbacks, *args, **kwargs)
    254     if len(args) != 1:
    255         raise ValueError("`run` supports only one positional argument.")
--> 256     return self(args[0], callbacks=callbacks)[self.output_keys[0]]
    258 if kwargs and not args:
    259     return self(kwargs, callbacks=callbacks)[self.output_keys[0]]

### Expected behavior

> Entering new APIChain chain...
https://api.open-meteo.com/v1/forecast?latitude=48.1351&longitude=11.5820&temperature_unit=fahrenheit&current_weather=true
{"latitude":48.14,"longitude":11.58,"generationtime_ms":0.33104419708251953,"utc_offset_seconds":0,"timezone":"GMT","timezone_abbreviation":"GMT","elevation":521.0,"current_weather":{"temperature":33.4,"windspeed":6.8,"winddirection":198.0,"weathercode":2,"time":"2023-01-16T01:00"}}

> Finished chain.
Add logging in PBI tool

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

Add some logging into the powerbi tool so that you can see the queries being sent to PBI and attempts to correct them.

<!-- Remove if not applicable -->

Fixes # (issue)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests, lint
etc:

https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested: @vowelparrot 

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
Issue: How to debug langchain speed issues?

### Issue you'd like to raise.

I have a simple_qa_with_sources chain - it uses unstructured library for PDF parsing, OpenAI embeddings, and FAISS vector DB. It takes about 10 seconds per query over a short 1 page document. 

I would like to speed this up - but is this performance expected? 

I profiled it and got this flamegraph where the majority of the time seems to be in a SSL socket read triggered by `generate_prompt`. It is mysterious to me why `generate_prompt` would be using the majority of the runtime. 

![no_cache](https://github.com/hwchase17/langchain/assets/1688894/9841433c-9b92-4915-847a-a8fa55f564f3)


### Suggestion:

I would like help understanding why `generate_prompt` takes so long doing SSL reads. I would also appreciate performance optimization documentation on langchain, thanks!
Add additional VertexAI Params

## Changes

- Added the `stop` param to the `_VertexAICommon` class so it can be set at llm initialization

## Example Usage

```python
VertexAI(
    # ...
    temperature=0.15,
    max_output_tokens=128,
    top_p=1,
    top_k=40,
    stop=["\n```"],
)
```

## Possible Reviewers

- @hwchase17 
- @agola11
Add support for the endpoint URL in DynamoDBChatMesasgeHistory

This PR adds the possibility of specifying the endpoint URL to AWS in the DynamoDBChatMessageHistory, so that it is possible to target not only the AWS cloud services, but also a local installation.

Specifying the endpoint URL, which is normally not done when addressing the cloud services, is very helpful when targeting a local instance (like [Localstack](https://localstack.cloud/)) when running local tests.

Fixes #5835

#### Who can review?

Tag maintainers/contributors who might be interested: @dev2049

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
Support for the AWS endpoint URL in the DynamoDBChatMessageHistory

### Feature request

I propose having the possibility of specifying the endpoint URL to AWS in the DynamoDBChatMessageHistory, so that it is possible to target not only the AWS cloud services, but also a local installation. 

### Motivation

Specifying the endpoint URL, which is normally not done when addressing the cloud services, is very helpful when targeting a local instance (like [Localstack](https://localstack.cloud/)) when running local tests. 

### Your contribution

I am providing this PR for the implementation: https://github.com/hwchase17/langchain/pull/5836/files
using MongoDBChatMessageHistory with agent and  RetrievalQA throws value is not a valid dict  error

### System Info

I want to develop a chatbot that answer questions to user based on the Pinecone vectors. And I want to save the chat history in MongoDB. The history part works well with buffer memory but gives value is not a valid dict error with MongoDB memory.

Here is the Code I'm using

```
def run_openai_llm_chain(vectorstore, query):
  # chat completion llm
  llm = ChatOpenAI()

  conversational_memory = ConversationBufferMemory(
      memory_key='chat_history',
      return_messages=True,
      # output_key="answer"
  )

  mongo_history = MongoDBChatMessageHistory(
        connection_string="mongodb+srv://alifaiz:database@cluster0.eq70b.mongodb.net", 
        session_id="new_session"
  )
  
  qa = RetrievalQA.from_chain_type(
    llm=llm, 
    chain_type='stuff',
    retriever=vectorstore.as_retriever(),
    # memory=mongo_history
  )

  tools = [
      Tool.from_function(
          func=qa.run,
          name="Reader",
          description="useful for when we need to answer question from context"
      )
  ]

  agent = initialize_agent(
      tools,
      llm,
      agent=AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION,
      verbose=True,
      memory=mongo_history
  )

  answer = agent.run(input=query)

  return answer
 ```


Error:
```
ValidationError: 1 validation error for AgentExecutor
memory
  value is not a valid dict (type=type_error.dict)
```

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

### Reproduction

Steps to reproduce the issue:
1. Use MongoDB as a memory in agents.

### Expected behavior

Chat history should be saved in my database.
langchain-server: ModuleNotFoundError: No module named 'langchain.cli'

### System Info

WSL Ubuntu 20.04

langchain                     0.0.192
langchainplus-sdk             0.0.4


### Who can help?

@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
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [x] Callbacks/Tracing
- [ ] Async

### Reproduction

I did as instructed in the link
https://python.langchain.com/en/latest/tracing/local_installation.html

```shell
pip install langchain --upgrade
langchain-server
```

### Expected behavior

❯ langchain-server
Traceback (most recent call last):
  File "/home/usr/miniconda3/envs/dev/bin/langchain-server", line 5, in <module>
    from langchain.server import main
  File "/home/usr/miniconda3/envs/dev/lib/python3.11/site-packages/langchain/server.py", line 5, in <module>
    from langchain.cli.main import get_docker_compose_command
ModuleNotFoundError: No module named 'langchain.cli'
Update openai embeddings notebook with correct embedding model in section 2
Labels: name: area: embeddings, name: auto:documentation

In second section it looks like a copy/paste from the first section and doesn't include the specific embedding model mentioned in the example so I added it for clarity.

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

<!-- Remove if not applicable -->

Fixes Didn't open an issue as this was a small change to the docs.

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests, lint
etc:

https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models


  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
@hwchase17
@agola11
Update openai.ipynb embedding to reflect model named in example

There were two sections showing how to call different embedding models with openai.  However, the second section was just a copy/paste from the first and didn't include the model name as intended I think.

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

<!-- Remove if not applicable -->

Fixes (didn't open an issue because this is a small change)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests, lint
etc:

https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
@hwchase17
@agola11

  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
@hwchase17
@agola11
reduce with long text

### Issue you'd like to raise.

I have a large text that I want to summarize using the load_summarize_chain map_reduce type. However, I found that the text is still too large after the reduce stage, exceeding the token limit. How can I generally solve this problem?

Error message:
A single document was so long it could not be combined with another document, we cannot handle this.

### Suggestion:

_No response_
Create snowflake Loader

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

<!-- Remove if not applicable -->

Fixes # (issue)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests, lint
etc:

https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
Support integer/float comparators for WeaviateTranslator

### Feature request

The WeaviateTranslator Class should allow for Comparators like GTE, GT, LT or LTE when using number/float attributes in Weaviate.

### Motivation

Currently, when using the [SelfQueryRetriever with Weaviate](https://python.langchain.com/en/latest/modules/indexes/retrievers/examples/weaviate_self_query.html), only Equal filters are allowed. For PineCone, this limitation does not exist.

The result is, that effectively Self-Query with Weaviate only works with Text attributes and not with number attributes, where e.g.  GreaterThan filters are useful. This is reflected in the [WeaviateTranslator class](https://github.com/hwchase17/langchain/blob/master/langchain/retrievers/self_query/weaviate.py), where "valueText" is hard-coded instead of dynamically adapted to the current path/attribute.

When initializing the SelfQueryRetriever, a list of used attributes + types is defined, so information, if an attribute is a text or number field, exists and could be forwarded to the WeaviateTranslator.

### Your contribution

I have adapted the WeaviateTranslator Class locally to work with the list of AttributeInfo, which is defined for the SelfQueryRetriever. For each attribute, it looks up the type in AttributeInfo and chooses "valueText" or "valueNumber" accordingly. This would allow for the usage of all available comparators.

If this feature is wanted, I could submit a PR.
add ocr_languages param for ConfluenceLoader.load()
Labels: name: lgtm

 @eyurtsev

当Confluence文档内容中包含附件，且附件内容为非英文时，提取出来的文本是乱码的。
When the content of the document contains attachments, and the content of the attachments is not in English, the extracted text is garbled.

这主要是因为没有为pytesseract传递lang参数，默认情况下只支持英文。
This is mainly because lang parameter is not passed to pytesseract, and only English is supported by default.

所以我给ConfluenceLoader.load()添加了ocr_languages参数，以便支持多种语言。
So I added the ocr_languages parameter to ConfluenceLoader.load () to support multiple languages.
skip openai params when embedding

### System Info

langchain@0.0.192
I upgrade my langchain lib by execute pip install -U langchain, and the verion is 0.0.192。But i found that openai.api_base not working. I use azure openai service as openai backend, the openai.api_base is very import for me. I hava compared tag/0.0.192 and tag/0.0.191, and figure out that:
![image](https://github.com/hwchase17/langchain/assets/6478745/cfa96128-da8a-4339-a92c-5e9031953763)
openai params is moved inside _invocation_params function，and used in some openai invoke:
![image](https://github.com/hwchase17/langchain/assets/6478745/e81e41e2-0ac0-4658-9d0d-57d2b347e026)
![image](https://github.com/hwchase17/langchain/assets/6478745/b5f4b9f5-5535-4026-9817-b1046751907a)
but still some case not covered like:
![image](https://github.com/hwchase17/langchain/assets/6478745/2c907b5d-81f7-4bf2-9e46-8ab409f99e60)



### Who can help?

@hwchase17 i have debug langchain and make a pr, plz review the pr:https://github.com/hwchase17/langchain/pull/5821, thanks

### Information

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

### Related Components

- [ ] LLMs/Chat Models
- [X] 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

1. pip install -U langchain
2. exeucte code next:  
```python
from langchain.embeddings import OpenAIEmbeddings
def main():
    embeddings = OpenAIEmbeddings(
        openai_api_key="OPENAI_API_KEY", openai_api_base="OPENAI_API_BASE",
    )
    text = "This is a test document."
    query_result = embeddings.embed_query(text)
    print(query_result)

if __name__ == "__main__":
    main()
```

### Expected behavior

same effect as langchain@0.0.191，
fix: fullfill openai params when embedding

<!--
Thank you for contributing to LangChain! Your PR will appear in our release under the title you set. Please make sure it highlights your valuable contribution.

Replace this with a description of the change, the issue it fixes (if applicable), and relevant context. List any dependencies required for this change.

After you're done, someone will review your PR. They may suggest improvements. If no one reviews your PR within a few days, feel free to @-mention the same people again, as notifications can get lost.

Finally, we'd love to show appreciation for your contribution - if you'd like us to shout you out on Twitter, please also include your handle!
-->

<!-- Remove if not applicable -->

Fixes #5822 
I upgrade my langchain lib by execute `pip install -U langchain`, and the verion is 0.0.192。But i found that openai.api_base not working. I use azure openai service as openai backend, the openai.api_base is very import for me. I hava compared tag/0.0.192 and tag/0.0.191, and figure out that:
![image](https://github.com/hwchase17/langchain/assets/6478745/e183fdb2-8224-45c9-b3b4-26d62823999a)
openai params is moved inside `_invocation_params` function，and used in some openai invoke:
![image](https://github.com/hwchase17/langchain/assets/6478745/5a55a048-5fa9-4bf4-aaef-3902226bec5e)
![image](https://github.com/hwchase17/langchain/assets/6478745/85b8cebc-eeb8-4538-a525-814719c8f8df)
but still some case not covered like:
![image](https://github.com/hwchase17/langchain/assets/6478745/e0297620-f2b2-4f4f-98bd-d0ed19022dac)

#### Before submitting

<!-- If you're adding a new integration, please include:

1. a test for the integration - favor unit tests that does not rely on network access.
2. an example notebook showing its use


See contribution guidelines for more information on how to write tests, lint
etc:

https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->

#### Who can review?

Tag maintainers/contributors who might be interested:
@hwchase17 

<!-- For a quicker response, figure out the right person to tag with @

  @hwchase17 - project lead

  Tracing / Callbacks
  - @agola11

  Async
  - @agola11

  DataLoaders
  - @eyurtsev

  Models
  - @hwchase17
  - @agola11

  Agents / Tools / Toolkits
  - @vowelparrot

  VectorStores / Retrievers / Memory
  - @dev2049

 -->
Issue: cannot using cuBLAS to accelerate

### Issue you'd like to raise.

so I am successfully use CPU version of LLama,
However, when I want to use cuBLAS to accelerate, BLAS = 0 in model properties.
My process is as following:
1. Since I am using HPC, I firstly load CUDA tookit by `module load`.
2. Set environment variable LLAMA_CUBLAS=1
3. Reinstall llama-cpp by `CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install --upgrade --force-reinstall llama-cpp-python`
4. Run as what the documentation said.

Here is what I got:
![image](https://github.com/hwchase17/langchain/assets/49300332/7a1c07a0-39f5-4603-ac0c-ec9215354126)


### Suggestion:

_No response_