delayedkarma/langchain-issues huggingface dataset:
3 different google search API varies a lot
Labels: name: area: agent, name: auto:bug

### System Info

Langchain 0.0.239

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

### Reproduction

The results I got from 3 different Google Search API Wrapper. The same thing happenes to the Agent with tool.

```python
from langchain.utilities import GoogleSerperAPIWrapper
search = GoogleSerperAPIWrapper()
search.run("What's the Tesla stock today?")
```
'266.44 +10.73 (4.20%)'

```python
from langchain.utilities import SerpAPIWrapper
search = SerpAPIWrapper()
print(search.run("What's the Tesla stock today?"))
```
Tesla, Inc. is an American multinational automotive and clean energy company headquartered in Austin, Texas. Tesla designs and manufactures electric vehicles, stationary battery energy storage devices from home to grid-scale, solar panels and solar roof tiles, and related products and services.

```python
from langchain.utilities import GoogleSearchAPIWrapper
search = GoogleSearchAPIWrapper()
search.run("What's the Tesla stock today?")
```
"In this week's video, I cover need-to-know news items related to Tesla (NASDAQ: TSLA) during the week of July 24. Today's video will focus on what Tesla\xa0... TSLA | Complete Tesla Inc. stock news by MarketWatch. View real-time stock prices ... Here's What One Survey Revealed About Their Perception Of Elon Musk. Tesla is accelerating the world's transition to sustainable energy with electric cars, solar and integrated renewable energy solutions for homes and\xa0... Tesla's mission is to accelerate the world's transition to sustainable energy. Today, Tesla builds not only all-electric vehicles but also infinitely\xa0... Get Tesla Inc (TSLA:NASDAQ) real-time stock quotes, news, price and financial ... Please contact cnbc support to provide details about what went wrong. Feb 2, 2023 ... Tesla stock soared 41% in January, its best month since October 2021, leaving investors breathless and wondering what to do next. TSLA: Get the latest Tesla stock price and detailed information including TSLA news, historical charts and ... What are analysts forecasts for Tesla stock? Aug 25, 2022 ... The question now is what do Tesla investors expect the stock to do after the split. Tesla (ticker: TSLA) stock on Thursday was trading at\xa0... Aug 25, 2022 ... The electric car company completed a 3-for-1 stock split after the closing bell Wednesday. So one share now costs a third of what it did a day\xa0... Jun 30, 2023 ... Doubling your money isn't easy, and doubling it in just six months is even more difficult, so investors now have to decide: Is It time to take\xa0..."

### Expected behavior

I except the result from these 3 API should be similar.
add test to ensure values in time weighted retriever are updated
Labels: name: auto:improvement

# What
- add test to ensure values in time weighted retriever are updated

<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: add test to ensure values in time weighted retriever are updated
  - Issue: None
  - Dependencies: None
  - Tag maintainer: @rlancemartin, @eyurtsev
  - Twitter handle: @MlopsJ


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(prompts): Add redirects in Prompt subcategories pages
Labels: name: auto:documentation

  - Description: Fixes broken links in some Prompts subcategories in documentation (Example Selectors, Prompt Templates)
  - Issue: #8477 (Fixes #8477)
  - Dependencies: None
  - Tag maintainer: @baskaryan
  - Twitter handle: [@BharatR123](https://twitter.com/BharatR123)
  
<!-- Thank you for contributing to LangChain!

Replace this comment with:
  - Description: Fixes broken links in some Prompts subcategories in documentation (Example Selectors, Prompt Templates)
  - Issue: #8477,
  - Dependencies: None,
  - Tag maintainer: @baskaryan,
  - Twitter handle: [@BharatR123](https://twitter.com/BharatR123)

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: Broken Links in Prompts Sub Categories Pages
Labels: name: auto:documentation

### Issue with current documentation:

The INFO: Python Guide links in both https://docs.langchain.com/docs/components/prompts/prompt-template and https://docs.langchain.com/docs/components/prompts/example-selectors are both broken (similar to #8105)

### Idea or request for content:

The pages have simply been moved from https://python.langchain.com/docs/modules/prompts/ to https://python.langchain.com/docs/modules/model_io/prompts/, so setting up corresponding redirects should fix it

I can open up a PR with the corresponding redirects myself
unsupported operand type(s) for +: 'SystemMessage' and 'HumanMessage'
Labels: name: auto:bug

### System Info

Langchain version: 0.0.247
python version: 3.11.0



### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

You can reproduce this issue according following link:
https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/prompts_pipelining

```
from langchain.prompts import ChatPromptTemplate, HumanMessagePromptTemplate
from langchain.schema import HumanMessage, AIMessage, SystemMessage

prompt = SystemMessage(content="You are a nice pirate")

new_prompt = (
    prompt
    + HumanMessage(content="hi")
    + AIMessage(content="what?")
    + "{input}"
)
```
prompy + HumanMessage(content="hi") will generate this issue

### Expected behavior

operand + for 'SystemMessage' and 'HumanMessage' should be support
AzureCognitiveSearchRetriever Issue 
Labels: name: area: vector store, name: auto:bug

### System Info

langchain-version: 0.0.246
AzureCognitiveSearchRetriever always return top 10 results as supposed to what was specified for top k
<img width="1158" alt="image" src="https://github.com/langchain-ai/langchain/assets/19245478/cb0e7317-8eee-4d9b-b71c-95c217451b42">


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

### Reproduction

retriever = AzureCognitiveSearchRetriever(api_version=api_version, top_k=3)
results = retriever.get_relevant_documents(chat_input.to_string())
print(retriever.top_k)
print(len(results))

### Expected behavior

The two print results are not the same
runnable.bind().bind() should combine kwargs, instead of nesting wrappers
Labels: name: auto:improvement



<!-- 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
 -->
Redis Meta data Filter changes
Labels: name: area: vector store, name: auto:improvement


  - Description: Adding Metadata filter to Redis, 
  - Issue: 3967,
  - Tag maintainer: @rlancemartin, @eyurtsev,
  - Twitter handle: nareshr8

Testing code:

```
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores.redis import Redis
from langchain.document_loaders import TextLoader

embeddings = OpenAIEmbeddings()
loader = TextLoader("./untitled.txt")
documents = loader.load()

# Editing metadata of document
documents[0].metadata = {"about":"langchain",'by':'text'}

# Inform the list of metadatakeys for indexing in redis for search
rds = Redis.from_documents(documents, embeddings,redis_url="redis://localhost:6379", index_name="sample",metadata_keys=['about','by'])

# Filter the documents based on metadata
rds.similarity_search('What should be used to load data from a source as Document',filter={"about":"langchain",'by':'text'})
```
BaseLoaderAsRetriever
Labels: name: area: doc loader, name: auto:enhancement

`BaseLoaderAsRetriever`, `QueryMixin` implementation; updated Arxiv to new base; ut-s; examples

Now, if Loader derives from BaseLoaderAsRetriever (not from BaseLoader) it can be used as a Retriever.

`Arxiv` is used as an example of `BaseLoaderAsRetriever`.

@hwchase17
Issue: OpenAI Bad Gateway results in Error in on_retry: asyncio.run() cannot be called from a running event loop (coroutine 'AsyncRunManager.on_retry' was never awaited) inside openai.acompletion_with_retry
Labels: name: auto:bug

### Issue you'd like to raise.

I just saw a novel error, which appears to be triggered by a failed OpenAI API call (inside an asynchronous block) which is causing an asyncio.run() inside an asyncio.run().  Error pasted below.  Is this my (user) error?  Or possibly a problem with the acompletion_with_retry() implementation?

```
2023-07-29 05:53:14,838 INFO     message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=None request_id=None response_code=502
2023-07-29 05:53:14,838 INFO     error_code=502 error_message='Bad gateway.' error_param=None error_type=cf_bad_gateway message='OpenAI API error received' stream_error=False
2023-07-29 05:53:14,839 WARNING  Retrying langchain.chat_models.openai.acompletion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised APIError: Bad gateway. {"error":{"code":502,"message":"Bad gateway.","param":null,"type":"cf_bad_gateway"}} 502 {'error': {'code': 502, 'message': 'Bad gateway.', 'param': None, 'type': 'cf_bad_gateway'}} <CIMultiDictProxy('Date': 'Sat, 29 Jul 2023 05:53:14 GMT', 'Content-Type': 'application/json', 'Content-Length': '84', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'Server': 'cloudflare', 'CF-RAY': '7ee3120dab9f1084-ORD', 'alt-svc': 'h3=":443"; ma=86400')>.
2023-07-29 05:53:14,839 ERROR    Error in on_retry: asyncio.run() cannot be called from a running event loop
/usr/local/python-modules/tenacity/__init__.py:338: RuntimeWarning: coroutine 'AsyncRunManager.on_retry' was never awaited
  self.before_sleep(retry_state)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
```



### Suggestion:

_No response_
Implement Runnable for Tools
Labels: name: auto:refactor

- Make _arun optional
- Pass run_manager to inner chains in tools that have them

<!-- 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
 -->
TypeError: issubclass() arg 1 must be a class
Labels: name: area: agent, name: area: doc loader, name: area: vector store, name: auto:bug

### System Info

I'm trying to use the tutorial on langchain but I get this error:

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[11], line 1
----> 1 from langchain.document_loaders import TextLoader
      2 print(langchain.__version__)
      3 loader = TextLoader("Scribbles.txt")

File [~/Dropbox/Personal/islington_news/myenv/lib/python3.9/site-packages/langchain/__init__.py:6](https://file+.vscode-resource.vscode-cdn.net/Users/davidelks/Dropbox/Personal/~/Dropbox/Personal/islington_news/myenv/lib/python3.9/site-packages/langchain/__init__.py:6)
      3 from importlib import metadata
      4 from typing import Optional
----> 6 from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
      7 from langchain.cache import BaseCache
      8 from langchain.chains import (
      9     ConversationChain,
     10     LLMBashChain,
   (...)
     16     VectorDBQAWithSourcesChain,
     17 )

File [~/Dropbox/Personal/islington_news/myenv/lib/python3.9/site-packages/langchain/agents/__init__.py:2](https://file+.vscode-resource.vscode-cdn.net/Users/davidelks/Dropbox/Personal/~/Dropbox/Personal/islington_news/myenv/lib/python3.9/site-packages/langchain/agents/__init__.py:2)
      1 """Interface for agents."""
----> 2 from langchain.agents.agent import (
      3     Agent,
      4     AgentExecutor,
      5     AgentOutputParser,
...
    851 if not isinstance(cls, _GenericAlias):
--> 852     return issubclass(cls, self.__origin__)
    853 return super().__subclasscheck__(cls)

TypeError: issubclass() arg 1 must be a class

```
I can't provide the version of langchain because I get this error. (I've got 0.0.247 from pip install.)

Running on MacOs Ventura. Python: 3.9.15

### Who can help?

@elksie5000

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

### Reproduction

from langchain.document_loaders import TextLoader
print(langchain.__version__)
loader = TextLoader("Scribbles.txt")
from langchain.indexes import VectorstoreIndexCreator
index = VectorstoreIndexCreator().from_loaders([loader]) 

### Expected behavior

The index to be created.
VectorStore.from_documents() takes 3 positional arguments but 4 were given
Labels: name: area: vector store, name: auto:bug

### System Info

... % python --version                
Python 3.11.4
... % pip show langchain | grep Version
Version: 0.0.247

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

### Reproduction

When following the langchain docs [here](https://python.langchain.com/docs/integrations/vectorstores/qdrant#qdrant-cloud), there will be an error thrown:

```py
qdrant = Qdrant.from_documents(
    docs,
    embeddings,
    url,
    prefer_grpc=True,
    api_key=api_key,
    collection_name="test",
)
```

error:
```
Traceback (most recent call last):
  File "...myscript.py", line 29, in <module>
    qdrant = Qdrant.from_documents(
             ^^^^^^^^^^^^^^^^^^^^^^
TypeError: VectorStore.from_documents() takes 3 positional arguments but 4 were given
```

Is it related to https://github.com/langchain-ai/langchain/pull/7910 ?

### Expected behavior

QDrant being initialized properly.
Create cr.yml
Labels: name: auto:enhancement

<!-- 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
 -->
Add instruction how to resolve dependency failures for dev
Labels: name: auto:documentation

Encountered the error "fastavro (1.7.4) not supporting PEP 517 build" while following instructions in CONTRIBUTING.md. Suggest the text how to resolve it.

<!-- 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
 -->
SitemapLoader: set proxy
Labels: name: area: doc loader, name: auto:enhancement

### Feature request

I am behind company firewall and I need to set proxy to `SitemapLoader`


### Motivation

I am behind company firewall

### Your contribution

Eg.:

```python
sitemap_loader = SitemapLoader(
    web_path="https://langchain.readthedocs.io/sitemap.xml", 
    https_proxy="https://my.proxy.io/"
)

docs = sitemap_loader.load()
```
GooglePalm requires google.generativeai?
Labels: name: auto:bug

### System Info

```python
from langchain.llms.base import LLM
from langchain.llms import GooglePalm
```

This throws an error saying it requires `google.generativeai`; pervious it used to work, something changed and is it documented? 

### Who can help?

@hwchase17
@agola11

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

```
pip install langchain
```

```python
from langchain.llms.base import LLM
from langchain.llms import GooglePalm
```

### Expected behavior

Should load without errors?