delayedkarma/langchain-issues huggingface dataset:
NameError: name 'partition_docx' is not defined
Labels: name: area: doc loader, name: auto:bug

### System Info

I have checked the issue tracker for similar issues but did not find any. Therefore, I am creating a new one.

I was trying to load a sample document using *UnstructuredFileLoader* from *langchain.document_loaders*. I was using T4 GPU on Google Colab. 

I think the issue might be related to some recent upgrades and maybe the solution is trivial. However, I am in a bit of a hurry as I have to submit my project report to my professor :disappointed:

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] 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

```
loader = UnstructuredFileLoader("/content/FAQ-ShelfLifeItem.docx")
documents = loader.load()
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)
docs = text_splitter.split_documents(documents)

hf_embedding = HuggingFaceInstructEmbeddings()
```

### Expected behavior

I would expect no errors like:
```
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
[<ipython-input-14-79f2c22bc34d>](https://localhost:8080/#) in <cell line: 2>()
      1 loader = UnstructuredFileLoader("/content/FAQ-ShelfLifeItem.docx")
----> 2 documents = loader.load()
      3 text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=50)
      4 docs = text_splitter.split_documents(documents)
      5 

2 frames
[/usr/local/lib/python3.10/dist-packages/unstructured/partition/auto.py](https://localhost:8080/#) in partition(filename, content_type, file, file_filename, url, include_page_breaks, strategy, encoding, paragraph_grouper, headers, skip_infer_table_types, ssl_verify, ocr_languages, pdf_infer_table_structure, xml_keep_tags, data_source_metadata, **kwargs)
    170             **kwargs,
    171         )
--> 172     elif filetype == FileType.MD:
    173         elements = partition_md(
    174             filename=filename,

NameError: name 'partition_docx' is not defined
```
Update google_cloud_enterprise_search.py to support structured data sources
Labels: name: lgtm, name: maintainer-to-merge, name: auto:improvement

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: Added the capability to handles structured data from google enterprise search, 
  - Issue: Retriever failed when underline search engine was integrated with structured data,
  - Dependencies: google-api-core
  - Tag maintainer: @jarokaz
  - Twitter handle: anifort

Please make sure you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

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.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Functional difference between GraphCypherQAChain and GraphQAChain
Labels: name: auto:question, name: area: models

### Feature request

What is the exact difference between the two graph based chains in langchain 1 )GraphCypherQAChain  and 2)GraphQAChain. What are the pros and cons of each, and when to use one over another? 

### Motivation

What is the exact difference between the two graph based chains in langchain 1 )GraphCypherQAChain  and 2)GraphQAChain. What are the pros and cons of each, and when to use one over another? 

### Your contribution

What is the exact difference between the two graph based chains in langchain 1 )GraphCypherQAChain  and 2)GraphQAChain. What are the pros and cons of each, and when to use one over another?
Fix a broken code block display
Labels: name: lgtm, name: auto:documentation

- Description: Fix a broken code block in this page: https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/
- Issue: N/A
- Dependencies: None
- Tag maintainer: @baskaryan
- Twitter handle: yaotti

## before
<img width="985" alt="image" src="https://github.com/yaotti/langchain/assets/18807/4707fff8-ca64-4144-b1d4-74f641b26f1a">

## after
<img width="987" alt="image" src="https://github.com/yaotti/langchain/assets/18807/d011384f-60a3-416d-99cf-5a29203c5b2b">
Issue: make command is not working after installing langchain
Labels: name: auto:bug

### Issue you'd like to raise.

I've been trying to install langchain using `pip install langchain[all]` in the conda environment where it already had packages to run hugging face text-generation-inference module. 

Let me know how to handle this issue. While running make command i'm facing this error.

```python
Traceback (most recent call last):
  File "/home/sri/miniconda3/envs/text-generation-inference/bin/make", line 5, in <module>
    from scripts.proto import main
ModuleNotFoundError: No module named 'scripts'

```

### Suggestion:

_No response_
Implement .transform() in RunnablePassthrough()
Labels: name: lgtm, name: auto:improvement

- This ensures passthrough doesnt break streaming

<!-- Thank you for contributing to LangChain!

Replace this 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 you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

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.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Issue: How to build a prompt that include SystemMessage, vector store context and final question
Labels: name: area: vector store, name: auto:question

### Issue you'd like to raise.

Hello guys ! 

I would like to build a Prompt which include a System message, Context data from a vector_store and the final question. What is the best way to do that?

Right now, I'm doing this:

```
def get_prompt(system_prompt):
    prompt = SystemMessage(content=system_prompt)
    new_prompt = (
    prompt
    + "--- \n\n" + "le contexte:" + "\n"
    + "{context}"
    + '\n\n --- \n\n ' + "la question: \n\n"
    + "{question}"
    )
    return PromptTemplate(
    template=new_prompt, input_variables=["context", "question"]
    )
```

But get this error: **KeyError: 'template'**

Is there a way to do what I want? I'm searching for a solution where I don't need to add the context myself, because it should already be managed by the vector store retriever 

### Suggestion:

_No response_
Agent vector store tool doc
Labels: name: lgtm, name: area: vector store, name: auto:documentation

I was initially confused weather to use create_vectorstore_agent or create_vectorstore_router_agent due to lack of documentation so I created  a simple documentation for each of the function about their different usecase.
Replace this comment with:
  - Description: Added the doc_strings in create_vectorstore_agent and create_vectorstore_router_agent to point out the difference in their usecase
  - Tag maintainer: @rlancemartin, @eyurtsev
The "search bar" and "mendable chat" should also follow the dark theme.
Labels: name: auto:improvement

## Issue with current `dark theme`:

Recently the documentation has been much improvised aesthetically and functionally. But when we switch to the dark mode, the search bar **on the top right** and the **mendable chat screen** remain in the light theme.

![image](https://github.com/langchain-ai/langchain/assets/83115948/0178f6b9-d867-4089-a0aa-7023fe6d075e)

I think, making them match the dark theme, will even out an overall experience ✌🏻
Adding new Github functions for reading pull requests
Labels: name: area: agent, name: lgtm, name: auto:improvement, name: size:XXL

The Github utilities are fantastic, so I'm adding support for deeper interaction with pull requests. Agents should read "regular" comments and review comments, and the content of PR files (with summarization or `ctags` abbreviations). 

Progress:
- [x] Add functions to read pull requests and the full content of modified files. 
- [x] Function to use Github's built in code / issues search.

Out of scope:
- Smarter summarization of file contents of large pull requests (`tree` output, or ctags).
- Smarter functions to checkout PRs and edit the files incrementally before bulk committing all changes. 
- Docs example for creating two agents:
  - One watches issues: For every new issue, open a PR with your best attempt at fixing it.
  - The other watches PRs: For every new PR && every new comment on a PR, check the status and try to finish the job.

<!-- Thank you for contributing to LangChain!

Replace this 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 you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

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.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
Bedrock embeddings async methods
Labels: name: area: embeddings, name: auto:improvement

## Description
This PR adds the `aembed_query` and `aembed_documents` async methods for improving the embeddings generation for large documents. The implementation uses asyncio tasks and gather to achieve concurrency as there is no bedrock async API in boto3.

### Maintainers
@agola11 
@aarora79  

### Open questions
To avoid throttling from the Bedrock API, should there be an option to limit the concurrency of the calls?
Typing issue: Undocumented parameter `client`
Labels: name: auto:bug, name: auto:documentation, name: area: models

### System Info

Python type checking complains about a parameter `client` with a simple setup like this:

<img width="170" alt="Screenshot 2023-08-10 at 12 20 53 PM" src="https://github.com/langchain-ai/langchain/assets/1828968/355100b6-11dc-4f73-beec-8059aba004f9">

<img width="534" alt="Screenshot 2023-08-10 at 12 03 14 PM" src="https://github.com/langchain-ai/langchain/assets/1828968/9eb22e4e-d78e-4b5b-ae98-6e649bffc14f">

According to documentation, no fields are required to initialize the model:
https://python.langchain.com/docs/modules/model_io/models/chat/

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

Version: langchain = "^0.0.250".
Python 3.11.4

Install Pylance. Use VSCode to run typecheck.

### Expected behavior

It should pass type checking based on documentation.
Duplicate ids passed into langchain\vectorstores\fais.__add will result in a mismatch between faiss and document's index
Labels: name: area: doc loader, name: area: vector store, name: auto:bug

### System Info

windows 10 
python 3.10.12

### Who can help?

@eyurtsev  There is a BUG in the def __add function in langchain\vectorstores\faiss.py: When the parameter ids is provided and there are duplicates in it, index_to_docstore_id will report an error and the program will terminate. But the text vector embedding has been added to the index. This causes the id in the index to be inconsistent with the id in index_to_docstore_id, not aligned, and the text cannot be matched correctly.

langchain\vectorstores\faiss.py 中 def __add 函数存在BUG:
当参数 ids 已提供, 且其中存在重复时, index_to_docstore_id 新增会报错,程序运行终止. 但是文本向量 embedding 已经添加至 index 中.导致 index 中的 id 与 index_to_docstore_id 的中 id 对应不一致,文本无法正确匹配

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

### Reproduction

None

### Expected behavior

None
ImportError when importing MultiQueryRetriever
Labels: name: area: vector store, name: auto:bug, name: area: models

### System Info

# System Info:
Langchain==0.0.260
Python==3.10.10

### 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
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [X] Callbacks/Tracing
- [ ] Async

### Reproduction

When using the following script from official documentation:
```python
from langchain.chat_models import ChatOpenAI
from langchain.retrievers.multi_query import MultiQueryRetriever

question = "What are the approaches to Task Decomposition?"
llm = ChatOpenAI(temperature=0)
retriever_from_llm = MultiQueryRetriever.from_llm(
    retriever=vectordb.as_retriever(), llm=llm
)
```

ImportError arise:
```bash
File /opt/conda/envs/gpt-env/lib/python3.10/site-packages/langchain/retrievers/multi_query.py:6
      2 from typing import List
      4 from pydantic import BaseModel, Field
----> 6 from langchain.callbacks.manager import CallbackManagerForRetrieverRun
      7 from langchain.chains.llm import LLMChain
      8 from langchain.llms.base import BaseLLM

ImportError: cannot import name 'CallbackManagerForRetrieverRun' from 'langchain.callbacks.manager' (/opt/conda/envs/gpt-env/lib/python3.10/site-packages/langchain/callbacks/manager.py)
```

### Expected behavior

There should be no issue when importing MultiQueryRetriever and using the script from the official documentation.
For the Visual currently it doesn't display or show tabular format with scroll bar
Labels: name: area: agent, name: auto:improvement

### Feature request

It would be good it create_pandas_dataframe_agent could return a table with scroll bar . Instead of us adding html code on the top of the generated code

### Motivation

Being able to capture table data is one key element of visualizations, currently create_pandas_dataframe_agent doesn't generate a table visualization with scroll bar

### Your contribution

I can try, but might need help
WebResearchRetriever - RuntimeError: asyncio.run() cannot be called from a running event loop
Labels: name: area: vector store, name: auto:bug

### System Info

Langchain version 0.0.260, Python 

### Who can help?

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

### Reproduction

Both chunks of code gave me the error. 
Chunk 1
`from langchain.chains import RetrievalQAWithSourcesChain
user_input = "How do LLM Powered Autonomous Agents work?"
qa_chain = RetrievalQAWithSourcesChain.from_chain_type(llm,retriever=web_research_retriever)
result = qa_chain({"question": user_input})
result`

Chunk 2 
'import logging
logging.basicConfig()
logging.getLogger("langchain.retrievers.web_research").setLevel(logging.INFO)
user_input = "How do LLM Powered Autonomous Agents work?"
docs = web_research_retriever.get_relevant_documents(user_input)
docs'

Both gave me this error 
`[/usr/lib/python3.10/asyncio/runners.py](https://localhost:8080/#) in run(main, debug)
     31     """
     32     if events._get_running_loop() is not None:
---> 33         raise RuntimeError(
     34             "asyncio.run() cannot be called from a running event loop")
     35 

RuntimeError: asyncio.run() cannot be called from a running event loop`


### Expected behavior

In both cases I just wanted it to produce website text with a source.
Add optional model kwargs to ChatAnthropic to allow overrides
Labels: name: lgtm, name: auto:improvement, name: area: models

<!-- Thank you for contributing to LangChain!

Replace this 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 you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

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.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->
DOC: API Reference: Classes are not sorted
Labels: name: area: doc loader, name: auto:documentation

### Issue with current documentation:

DOC: API Reference: Classes are not sorted in the root page. It is really hard to search for unsorted items.
For example:
```
...
agents.agent_iterator.AgentExecutorIterator(...)
agents.agent.ExceptionTool
agents.agent.LLMSingleActionAgent
agents.tools.InvalidTool
agents.schema.AgentScratchPadChatPromptTemplate
agents.agent_types.AgentType(value[, names, ...])
agents.xml.base.XMLAgent
agents.xml.base.XMLAgentOutputParser
...
```

### Idea or request for content:

_No response_
Conversational agent returning action plan as response after 0.0.260 release
Labels: name: area: agent, name: auto:bug

### System Info

After I upgraded my Langchain to version 0.0.260, the ConversationalChatAgent returns the action plan as the chat response.

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

Steps to reproduce: request something that will make a ConversationalChatAgent call a tool.

### Expected behavior

The agent should pass the action and action_input to the tool and not return it as a final response to the user.
Add logprobs to SamplingParameters in vllm
Labels: name: auto:improvement, name: area: models

<!-- Thank you for contributing to LangChain!

Replace this 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 you're PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

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.

Maintainer responsibilities:
  - General / Misc / if you don't know who to tag: @baskaryan
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @baskaryan
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @hinthornw
  - Tracing / Callbacks: @agola11
  - Async: @agola11

If no one reviews your PR within a few days, feel free to @-mention the same people again.

See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
 -->

This PR aims at amending #8806 , that I opened a few days ago, adding the extra `logprobs` parameter that I accidentally forgot
Locals in config
Labels: name: lgtm, name: auto:refactor, name: area: models

Alternate implementation of #8772. just a proof of concept, im sure there's lots of broken stuff
![Screenshot 2023-08-09 at 2 14 16 PM](https://github.com/langchain-ai/langchain/assets/22008038/df76700f-8fe1-4a3a-95a4-f3a22ae935bd)