delayedkarma/langchain-issues huggingface dataset:
pandas dataframe agent generates correct Action Input, but returns incorrect result

### System Info

Langchain version: 0.0.180


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

### Reproduction

I'm running the example from docs: https://python.langchain.com/en/latest/modules/agents/toolkits/examples/pandas.html. 

`agent.run("how many people are 28 years old?")`

gives:
```
> Entering new AgentExecutor chain...
Thought: I need to use the `df` dataframe to find how many people are 28 years old.
Action: python_repl_ast
Action Input: df['Age'] == 28
Observation: 0
Thought: There are no people 28 years old.
Final Answer: 0
```

In other cases, the Action Input the LLM calculates is correct, but the observation (result of applying this action on the dataframe) is incorrect. This makes me believe that the LLM isn't at fault here.


### Expected behavior

Should return 25.
Added pipline args to `HuggingFacePipeline.from_model_id`
Labels: name: lgtm

The current `HuggingFacePipeline.from_model_id` does not allow passing of pipeline arguments to the transformer pipeline.
This PR enables adding important pipeline parameters like setting `max_new_tokens` for example.
Previous to this PR it would be necessary to manually create the pipeline through huggingface transformers then handing it to langchain.

For example instead of this
```py
model_id = "gpt2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
pipe = pipeline(
    "text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10
)
hf = HuggingFacePipeline(pipeline=pipe)
```
You can write this
```py
hf = HuggingFacePipeline.from_model_id(
    model_id="gpt2", task="text-generation", pipeline_kwargs={"max_new_tokens": 10}
)
```

## Who can review?
@hwchase17
@agola11
UnstructuredMarkdownLoader resulting in `zipfile.BadZipFile: File is not a zip file`

### System Info

```
langchain==0.0.180
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Windows 11
```

### Who can help?

@eyurtsev

### Information

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

### Related Components

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

### Reproduction

Python Code
```
from langchain.document_loaders import UnstructuredMarkdownLoader
markdown_path = r"Pyspy.md"
loader = UnstructuredMarkdownLoader(markdown_path)
data = loader.load()
```

Markdown file `Pyspy.md`
```
    ```
     .pip/bin/py-spy top -p 70
    ```
```



### Expected behavior

It should result in List[Document] in data
Zep SDK Version Update
Labels: name: maintainer-to-merge

# Zep SDK Version Update

zep-python's sync methods no longer need an asyncio wrapper. This was causing issues with FastAPI deployment.
Zep also now supports putting and getting of arbitrary message metadata.

- Bump zep-python version to v0.30
- Remove `nest-asyncio` from Zep example notebooks.
- Modify tests to include metadata.

     
    - @dev2049
Assertion Error when using VertexAIEmbeddings with faiss vectorstore

```
~\Anaconda3\lib\site-packages\langchain\memory\vectorstore.py in save_context(self, inputs, outputs)
     67         """Save context from this conversation to buffer."""
     68         documents = self._form_documents(inputs, outputs)
---> 69         self.retriever.add_documents(documents)
     70 
     71     def clear(self) -> None:

~\Anaconda3\lib\site-packages\langchain\vectorstores\base.py in add_documents(self, documents, **kwargs)
    413     def add_documents(self, documents: List[Document], **kwargs: Any) -> List[str]:
    414         """Add documents to vectorstore."""
--> 415         return self.vectorstore.add_documents(documents, **kwargs)
    416 
    417     async def aadd_documents(

~\Anaconda3\lib\site-packages\langchain\vectorstores\base.py in add_documents(self, documents, **kwargs)
     60         texts = [doc.page_content for doc in documents]
     61         metadatas = [doc.metadata for doc in documents]
---> 62         return self.add_texts(texts, metadatas, **kwargs)
     63 
     64     async def aadd_documents(

~\Anaconda3\lib\site-packages\langchain\vectorstores\faiss.py in add_texts(self, texts, metadatas, ids, **kwargs)
    150         # Embed and create the documents.
    151         embeddings = [self.embedding_function(text) for text in texts]
--> 152         return self.__add(texts, embeddings, metadatas=metadatas, ids=ids, **kwargs)
    153 
    154     def add_embeddings(

~\Anaconda3\lib\site-packages\langchain\vectorstores\faiss.py in __add(self, texts, embeddings, metadatas, ids, **kwargs)
    117         if self._normalize_L2:
    118             faiss.normalize_L2(vector)
--> 119         self.index.add(vector)
    120         # Get list of index, id, and docs.
    121         full_info = [(starting_len + i, ids[i], doc) for i, doc in enumerate(documents)]

~\Anaconda3\lib\site-packages\faiss\class_wrappers.py in replacement_add(self, x)
    226 
    227         n, d = x.shape
--> 228         assert d == self.d
    229         x = np.ascontiguousarray(x, dtype='float32')
    230         self.add_c(n, swig_ptr(x))

AssertionError: 
```
Support bigquery dialect - SQL
Labels: name: lgtm

# Your PR Title (What it does)

Adding an if statement to deal with bigquery sql dialect. When I use bigquery dialect before, it failed while using SET search_path TO. So added a condition to set dataset as the schema parameter which is equivalent to SET search_path TO . I have tested and it works.


## Who can review?

Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:
@dev2049
Build an abstract dialogue model using classes and methods to represent different dialogue elements
Labels: name: needs work

# Build an abstract dialogue model using classes and methods to represent different dialogue elements


Fixes # None

## Before submitting


If you want to review, please refer to the quick start example provided in langchain/chains/dialogue_answering/__main__.py. You may need to set the openaikey and the following startup parameters: --dialogue-path: the location of the dialogue file, --embedding-model: the HuggingFaceEmbeddings model to use (defaults to GanymedeNil/text2vec-large-chinese) if not specified.

Regarding the format of the dialogue file, please refer to the following information:
```text
sun:
Has the offline model been run?

glide-the:
Yes, it has been run, but the results are not very satisfactory.

glide-the:
It lacks chat intelligence and falls far behind in terms of logic and reasoning.

sun:
Are you available for voice chat?

glide-the:
I'm considering using this offline model: https://huggingface.co/chat

glide-the:
voice chat okay.

glide-the:
You can take a look at the dev_agent branch of the langchain-chatglm project.

glide-the:
There's a dialogue model question-answering example under the agent.

sun:
Alright.

glide-the:
The specified chat record file is exported from WeChat.
```
## Who can review?


Including lorader and agent applications


- @eyurtsev
- @vowelparrot
- @dev2049
Inconsistent documentation for langchain.chains.FlareChain
Labels: name: documentation

### Question
Will there be future updates where we are allowed to customize answer_gen_llm when using FlareChain?

### Context
In the [documentation](https://python.langchain.com/en/latest/modules/chains/examples/flare.html) it says that:

In order to set up this chain, we will need three things:
- An LLM to generate the answer
- An LLM to generate hypothetical questions to use in retrieval
- A retriever to use to look up answers for

However, the example code only allows specification for the question_gen_llm, not the answer_gen_llm. 

After referencing the [code](https://github.com/hwchase17/langchain/blob/9c0cb90997db9eb2e2a736df458d39fd7bec8ffb/langchain/chains/flare/base.py) for FlareChain, it seems that the answer_gen_llm is initialized as `OpenAI(max_tokens=32, model_kwargs={"logprobs": 1}, temperature=0)`, which default to `"text-davinci-003"` as no model_name is specified.
Issue: <Streaming mode not work for Sequential Chains>

### Issue you'd like to raise.

hi, team:

I created Chain_A and Chain_B and set streaming=True for both of them.

overall_chain = SequentialChain(
    chains=[chain_A, chain_B],
    input_variables=["era", "title"],
    output_variables=["synopsis", "review"],
    verbose=True)

However, the streaming does not work.

### Suggestion:

_No response_
how to monitoring the new files after directory loader class used

### Feature request

I am using langchain + openai api to create a chatbot for private data, i can use langchain directory loader class to load files from a directory, but if any new files added to that directory, how to automatically load it?

### Motivation

https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/file_directory.html

### Your contribution

if can solve the problem, it will be good for company to use it for internal knowdege base share.
Issue: Add topics to the GitHub repos

### Issue you'd like to raise.

Hello, would it be possible to add the topics (tags) to the repositories, it would be easier to find and organize them afterward. And its also usefull for external tools that are fetching github API to track repos ! Here is an example from HuggingFace :
.
<img width="538" alt="Capture d’écran 2023-05-25 à 15 58 11" src="https://github.com/hwchase17/langchain/assets/90518536/8a0029ad-6c44-426b-bc9d-2b01fcad46a7">
.
And here is a more specific screenshot in case I'm using the wrong words (sry not english) : 
.
<img width="1440" alt="Capture d’écran 2023-05-25 à 16 03 40" src="https://github.com/hwchase17/langchain/assets/90518536/5aa4574d-1ae4-4bca-8ad5-044f3ce4a3cf">


### Suggestion:

I think you already know how, clicking the button on the repo page, then in about > topics, adding stuff like "python" "ai" "artificial intelligence" etc... thank you ! 😃
Weaviate: Add QnA with sources example

# Add QnA with sources example 

<!--
Thank you for contributing to LangChain! Your PR will appear in our next 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.
-->

<!-- Remove if not applicable -->

Fixes: see https://stackoverflow.com/questions/76207160/langchain-doesnt-work-with-weaviate-vector-database-getting-valueerror/76210017#76210017

## Before submitting

<!-- If you're adding a new integration, include an integration test and an example notebook showing its use! -->

## Who can review?

Community members can review the PR once tests pass. 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
        
 -->
@dev2049
Issue: import 'LLMContentHandler' from 'langchain.llms.sagemaker_endpoint failing

### Issue you'd like to raise.

`!pip3 install langchain==0.0.179 boto3`

After installing langchain using the above command and trying to run the example mentioned in

[](https://python.langchain.com/en/latest/modules/models/llms/integrations/sagemaker.html)

Getting the below error.

`ImportError:` cannot import name 'LLMContentHandler' from 'langchain.llms.sagemaker_endpoint' `(/opt/conda/lib/python3.10/site-packages/langchain/llms/sagemaker_endpoint.py)`

Am I missing something


### Suggestion:

_No response_
Add possibility to set a proxy for openai API access

### Feature request

For a deployment behind a corporate proxy, it's useful to be able to access the API by specifying an explicit proxy. 

### Motivation

Currently it's possible to do this by setting the environment variables http_proxy / https_proxy to set a proxy for the whole python interpreter. However this then prevents access to other internal servers. accessing other network resources (e.g. a vector database on a different server, corporate S3 storage etc.) should not go through the proxy. So it's important to be able to just proxy requests for externally hosted APIs. We are working with the OpenAI API and currently we cannot both access those and our qdrant database on another server.

### Your contribution

Since the openai python package supports the proxy parameter, this is relatively easy to implement for the OpenAI API. I'll submit a PR.
'numpy._DTypeMeta' object is not subscriptable

### System Info

I am using langchain version of 0.0.176 and hitting the error of 'numpy._DTypeMeta' object is not subscriptable while using Chroma DB for carrying out any operation. 

### Who can help?

@hwchase17  - please help me out with this error -- do I need to upgrade the version of Langchain to overcome this problem

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

Code snippets producing this behavior
1. docsearch=Chroma.from_texts(texts,embeddings,metadatas=[{"source":str(i)} for i in range(len(texts))]).as_retriever()
2. docsearch=Chroma.from_texts(texts,embeddings)
query="...."
docs=docsearch.similarity_search(query)
3. db1=Chroma.from_documents(docs_1,embeddings)

### Expected behavior

Should be able to use ChromaDb as a retriever without hitting any error.
Issue: How to make a request into an agent/tool

### Issue you'd like to raise.

Hi everybody, does anyone know if there is a way to make a post request using a custom agent/tool? The idea is when the user need a specific thing  the agent intercept it and the custom tool make it. I can't find anything useful in the documentation, the fact is that when I try it doesn't work.

In my case I have:

`class FlowTool(BaseTool):
    name = "Call To Max"
    description = "use the run function when the user ask to make a call to Max. You don't need any parameter"

    def _run(self):
        url = "https://ex.mex.com/web"
        data = {
            "prova": 'ciao'
        }
        response = requests.post(url, json=data, verify=False)
        return 'done'
     

    def _arun(self, radius: int):
        raise NotImplementedError("This tool does not support async")`
        
        
        
`tools = [FlowTool()]
agent = initialize_agent(
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    tools=tools,
    llm=llm,
    verbose=True,
    max_iterations=3,
    early_stopping_method='generate',
)`


`agent("Can you make a call to mex?")`


Thank you for helping me




### Suggestion:

_No response_
Resolve error in StructuredOutputParser docs

# Resolve error in StructuredOutputParser docs

Documentation for `StructuredOutputParser` currently not reproducible, that is, `output_parser.parse(output)` raises an error because the LLM returns a response with an invalid format

```python
_input = prompt.format_prompt(question="what's the capital of france")
output = model(_input.to_string())

output

# ?
#
# ```json
# {
# 	"answer": "Paris",
# 	"source": "https://www.worldatlas.com/articles/what-is-the-capital-of-france.html"
# }
# ```
```

Was fixed by adding a question mark to the prompt
Issue: ElasticsearchEmbeddings does not work on hosted elasticsearch (Platinum) 

### Issue you'd like to raise.

LangChain 0.0.179,  hosted elasticsearch (Platinum edition)

V0.0.179 introduced elasticsearch embeddings, great! 

But it is only implemented for elastic cloud.

I want to be able to do embeddings on my own elastic cluster.

@jeffvestal @derickson


### Suggestion:

_No response_
Token limit reached trying to use plugin

### System Info

When i try to use chatgpt plugin with agents like showed in the documentantion, some plugins like the MediumPluginGPT will reach the token limit during the task and give an error.

![image](https://github.com/hwchase17/langchain/assets/134293046/940e6342-6396-4910-be08-117567d5bfdc)


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

### Reproduction

https://colab.research.google.com/drive/1Pya_AaPucsgw__OJa0Xho1u8OI1xFqYB#scrollTo=Ri2RPTKrxF6b

### Expected behavior

Should return the ten new most recent about AI
Slots Filling in Langchain

### System Info

I need to use OpenAPI for calling an API , but that API needs some params in body, and that value needs to be taken from User, 
I need to understand the way that can take slots name that needs to be filled from user , is there any wat to do this?

### 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
- [X] Chains
- [X] Callbacks/Tracing
- [ ] Async

### Reproduction

Need code

### Expected behavior

Slots filling from user
Support for ttl in DynamoDBChatMessageHistory

### Feature request

Allow a user to specify a record ttl for messages/sessions persisted to dynamodb in https://github.com/hwchase17/langchain/blob/5cfa72a130f675c8da5963a11d416f553f692e72/langchain/memory/chat_message_histories/dynamodb.py#L17-L20.

### Motivation

This will allow automated purging of chat history after a specified time period.  

### Your contribution

Maybe, depends on my available time.
Make Redis Vector database operations Asynchronous

### Feature request

There are other vector database that support the use of async in Langchain, adding Redis to those list would be better for programmers who use asynchronous programming in python. I believe with package like aioredis, this should be easily achievable.

### Motivation

The motivation to to be able to support python async programmers with this feature and also to boost performance when querying from the vector store and inserting data into the vector store.

### Your contribution

I can contribute by opening a PR or by testing the code once it is done.
ChatVertexAI is not imported

### System Info

Hello, 

I'm trying to use ChatVertexAI and I noticed that the following import is not working : 

```python 
from langchain.chat_models import ChatVertexAI
```
But this one is working correctly : 
```python
from langchain.chat_models.vertexai import ChatVertexAI
```


### Who can help?

@hwchase17

### Information

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

1. install the main branch: `pip install git+https://github.com/hwchase17/langchain.git`
2. try to import `from langchain.chat_models import ChatVertexAI`
3. try to import `from langchain.chat_models.vertexai import ChatVertexAI`


### Expected behavior

The import `from langchain.chat_models import ChatVertexAI` should work