delayedkarma/langchain-issues huggingface dataset:
should be @search.rerankerScore, not @search.score for hybrid semantic search  (Azure Cognitive Search)
Labels: name: area: vector store, name: auto:bug

### System Info

latest langchain code AzureSearch at langchain/libs/langchain/langchain/vectorstores/azuresearch.py:
semantic_hybrid_search_with_score function, when returning search result, the score should be @search.rerankerScore, not @search.score for hybrid semantic search, according to the latest Azure Doc here: https://learn.microsoft.com/en-us/azure/search/hybrid-search-ranking

### Who can help?

@hwchase17 

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

the code is not following the latest Azure Search document: https://learn.microsoft.com/en-us/azure/search/hybrid-search-ranking


### Expected behavior

  float(result["@search.rerankerScore"])  (instead of   float(result["@search.score"]))
OpenAIEmbeddings vector different from the openai library and changes from time to time
Labels: name: area: embeddings, name: auto:bug

### System Info

I got different embedding results using OpenAIEmbeddings and the original openai library. Besides the embeddings from both OpenAIEmbeddings and openai change from time to time. Sometimes it returns the same results but sometimes it returns differently , especially after I exceeds the time limit.

I am using langchain-0.0.321. I tried dig a little deeper in the OpenAIEmbeddings source code and find that there is a process using the tokenizer. I tried use the same tokenizer in the original openai library and get the same result compared to not using it, so I think this is not the problem. Can someone explain a little bit why the results in different libraries and different requests may change? 




### Who can help?

_No response_

### Information

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

```python
import openai
from langchain.embeddings.openai import OpenAIEmbeddings

text = 'where are you going'
vec1 = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY).embed_query(text)
vec2 = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY).embed_query(text)

if not vec1 == vec2:
    print('vec1:', vec1[:3])
    print('vec2:', vec2[:3])

vec3 = openai.Embedding.create(input=[text], model='text-embedding-ada-002')['data'][0]['embedding']

if not (vec1 == vec3 or vec2 == vec3):
    print('vec1:', vec1[:3])
    print('vec2:', vec2[:3])
    print('vec3:', vec3[:3])
```

### Expected behavior

the results are as below
```
vec1: [0.0004729258755920449, -0.011402048647760918, -0.012062848996486476]
vec2: [0.00046853933082822383, -0.01143268296919534, -0.012086534739296315]

vec1: [0.0004729258755920449, -0.011402048647760918, -0.012062848996486476]
vec2: [0.00046853933082822383, -0.01143268296919534, -0.012086534739296315]
vec3: [0.00040566621464677155, -0.011434691026806831, -0.012049459852278233]

```
Elevenlabs-langchain API should integrate very important parameter 'voice'
Labels: name: auto:improvement, name: area: models

### Feature request

The langchain API integration Elevenlabs should accomodate the very important parameter `voice`.



### Motivation

Without the voice parameter, the Elevenlabs langchain integration is unusable because `play()` switches the voice randomly with every execution.

### Your contribution

I tracked down the releveant code in the [Elevenlabs-langchain integration API](https://api.python.langchain.com/en/latest/_modules/langchain/tools/eleven_labs/text2speech.html#ElevenLabsText2SpeechTool.stream_speech) down to this section:

```
def _run(
        self, query: str, run_manager: Optional[CallbackManagerForToolRun] = None
    ) -> str:
        """Use the tool."""
        elevenlabs = _import_elevenlabs()
        try:
            speech = elevenlabs.generate(text=query, model=self.model)
            with tempfile.NamedTemporaryFile(
                mode="bx", suffix=".wav", delete=False
            ) as f:
                f.write(speech)
            return f.name
        except Exception as e:
            raise RuntimeError(f"Error while running ElevenLabsText2SpeechTool: {e}")

[[docs]](https://api.python.langchain.com/en/latest/tools/langchain.tools.eleven_labs.text2speech.ElevenLabsText2SpeechTool.html#langchain.tools.eleven_labs.text2speech.ElevenLabsText2SpeechTool.play)    def play(self, speech_file: str) -> None:
        """Play the text as speech."""
        elevenlabs = _import_elevenlabs()
        with open(speech_file, mode="rb") as f:
            speech = f.read()

        elevenlabs.play(speech)


[[docs]](https://api.python.langchain.com/en/latest/tools/langchain.tools.eleven_labs.text2speech.ElevenLabsText2SpeechTool.html#langchain.tools.eleven_labs.text2speech.ElevenLabsText2SpeechTool.stream_speech)    def stream_speech(self, query: str) -> None:
        """Stream the text as speech as it is generated.
        Play the text in your speakers."""
        elevenlabs = _import_elevenlabs()
        speech_stream = elevenlabs.generate(text=query, model=self.model, stream=True)
        elevenlabs.stream(speech_stream)
```

The calls to `elevenlabs.generate` and `elevenlabs.play` must be extended with the `voice` parameter.

After this change, the langchain calls `run`, `play`, and importantly, `stream_speech`, could be made analogue the calls from the ElevenLabs API, e.g. seen [in this repo](https://github.com/langchain-ai/langchain/issues/1076#issuecomment-1552363555):
```
  prediction = agent_chain.run(input=user_input.text)
    audio = generate(
        text=prediction,
        voice="Adam",
        model="eleven_monolingual_v1"
    )
```
Enhance GoogleDriveLoader to Support Spreadsheets when loading documents from ids (issue #3637)
Labels: name: area: doc loader, name: auto:improvement

**Issue**: [#3637]

**Summary**:
The codebase includes a private method `_load_sheet_from_id` that can handle Google Sheets, which is currently only invoked when loading documents from a folder. This PR aims to unify the document loading approach, ensuring both individual IDs and folders consider the `mimeType` to determine the document type.

**Changes**:
1. Introduced `_process_file_by_mimetype` function to handle the processing logic based on file `mimeType`, reducing code repetition.
2. Refactored `_load_documents_from_ids` and `_load_documents_from_folder` to utilize the new `_process_file_by_mimetype` function, ensuring consistent behavior.

Reminder
If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
removed CardLists for LLMs and ChatModels
Labels: name: auto:documentation, name: area: models

Problem statement: 
In the `integrations/llms` and `integrations/chat` pages, we have a sidebar with ToC, and we also have a ToC at the end of the page. 
The ToC at the end of the page is not necessary, and it is confusing when we mix the index page styles; moreover, it requires manual work.
So, I removed  ToC at the end of the page (it was discussed with and approved by @baskaryan)
Update telegram.py
Labels: name: area: doc loader, name: auto:improvement

This will add the message URL to the existing data returned by TelegramChatApiLoader without needing to modify much else in the source code.

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **This will add the message URL to the existing data returned by TelegramChatApiLoader without needing to modify much else in the source code.:** a description of the change, 
  - **12246** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
15 Oct Update telegram.py
Labels: name: area: doc loader, name: auto:improvement

Update Telegram.py  This will add the message URL to the existing data returned by TelegramChatApiLoader without needing to modify much else in the source code.

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **This will add the message URL to the existing data returned by TelegramChatApiLoader without needing to modify much else in the source code.:** a description of the change, 
  - **12246:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
feat: Add Google Speech to Text API Document Loader
Labels: name: area: doc loader, name: auto:enhancement

- Add Document Loader for Google Speech to Text
  - Similar Structure to [Assembly AI Document Loader][1]

[1]: https://python.langchain.com/docs/integrations/document_loaders/assemblyai

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Strips leading/trailing whitespace before parsing xml
Labels: name: auto:improvement

**Description:** When llms output leading or trailing whitespace for xml (when using XMLOutputParser) the parser would raise a `ValueError: Could not parse output: ...`. However, leading or trailing whitespace are "ignorable" in the sense of XML standard.

**Issue:** I did not find an issue related.

**Dependencies:** None

**Tag maintainer:**

**Twitter handle:** donatoaz

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

Done, updated unit test and ran `make docker_test`.
dev guide
Labels: name: auto:documentation

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Not able to print verbose result in interface.
Labels: name: auto:question, name: area: models

### Issue you'd like to raise.

Terminal Output:
> Entering new SQLDatabaseChain chain...
how many tracks have pop genre?
SQLQuery:SELECT COUNT(*) FROM tracks WHERE "GenreId" = 3 LIMIT 5;
SQLResult: [(374,)]
Answer:374 tracks have pop genre.
> Finished chain.

How do I access and print the SQLQuery, SQLResult in my ui? 
im only able to print the Answer here in response
with st.chat_message("bot"):
 st.markdown(response)



### Suggestion:

_No response_
langchain-experimental csv_agent how to?
Labels: name: area: agent, name: auto:question, name: auto:documentation

### Issue with current documentation:

How can I use csv_agent with langchain-experimental being that importing csv_agent from langchain.agents now produces this error:

On 2023-10-27 this module will be be deprecated from langchain, and will be available from the langchain-experimental package.This code is already available in langchain-experimental.See https://github.com/langchain-ai/langchain/discussions/11680.

### Idea or request for content:

_No response_
Update README.md
Labels: name: lgtm, name: auto:documentation

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
README.md
Labels: name: auto:documentation

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Remove CLI
Labels: name: auto:refactor

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
Pop max concurrency when recursing
Labels: name: auto:nit, name: area: models

<!-- Thank you for contributing to LangChain!

Replace this entire comment with:
  - **Description:** a description of the change, 
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** any dependencies required for this change,
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out!

Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally.

See contribution guidelines for more information on how to write/run tests, lint, etc: 
https://github.com/langchain-ai/langchain/blob/master/.github/CONTRIBUTING.md

If you're adding a new integration, please include:
  1. a test for the integration, preferably unit tests that do not rely on network access,
  2. an example notebook showing its use. It lives in `docs/extras` directory.

If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17.
 -->
DOC: Error in code for splitting and summarizing in a single chain
Labels: name: area: doc loader, name: auto:bug, name: auto:documentation

### Issue with current documentation:

There is an error in the code. [link](https://python.langchain.com/docs/use_cases/summarization#splitting-and-summarizing-in-a-single-chain)

```
from langchain.chains import AnalyzeDocumentChain

summarize_document_chain = AnalyzeDocumentChain(combine_docs_chain=chain, text_splitter=text_splitter)
summarize_document_chain.run(docs[0])
```
```
    ---------------------------------------------------------------------------

    ValueError                                Traceback (most recent call last)

    Cell In[17], line 4
          1 from langchain.chains import AnalyzeDocumentChain
          3 summarize_document_chain = AnalyzeDocumentChain(combine_docs_chain=chain, text_splitter=text_splitter)
    ----> 4 summarize_document_chain.run(docs[0])


    File ~/langchain/libs/langchain/langchain/chains/base.py:496, in Chain.run(self, callbacks, tags, metadata, *args, **kwargs)
        459 """Convenience method for executing chain.
        460 
        461 The main difference between this method and `Chain.__call__` is that this
       (...)
        493         # -> "The temperature in Boise is..."
        494 """
        495 # Run at start to make sure this is possible/defined
    --> 496 _output_key = self._run_output_key
        498 if args and not kwargs:
        499     if len(args) != 1:


    File ~/langchain/libs/langchain/langchain/chains/base.py:445, in Chain._run_output_key(self)
        442 @property
        443 def _run_output_key(self) -> str:
        444     if len(self.output_keys) != 1:
    --> 445         raise ValueError(
        446             f"`run` not supported when there is not exactly "
        447             f"one output key. Got {self.output_keys}."
        448         )
        449     return self.output_keys[0]


    ValueError: `run` not supported when there is not exactly one output key. Got ['output_text', 'intermediate_steps'].
```

### Idea or request for content:

There is nothing missing but the code needs to be accurate so the code returns the expected output.
CohereEmbeddings: Add max_retries and request_timeout
Labels: name: area: embeddings, name: auto:improvement

Add max_retries and request_timeout to CohereEmbeddings, akin to how it works in OpenAIEmbeddings.

Since the Cohere client already implements these parameters, we can simply pass them down.

Uses parameters from these two cohere client objects:

https://github.com/cohere-ai/cohere-python/blob/main/cohere/client.py
https://github.com/cohere-ai/cohere-python/blob/main/cohere/client_async.py
Add Cube Semantic Layer Agent
Labels: name: area: agent, name: auto:enhancement, name: size:XXL

  - **Description:** SQL Chains and Agents support building and running SQL queries based on natural language prompts. However, when faced with complex queries, they may not perform well in producing results.
Now, I'm providing a Cube Semantic Layer Agent, which can better support complex queries. A Cube data model is used to transform raw data into meaningful business definitions and pre-aggregate data for optimal results.
  - **Twitter handle:** @JohnMai95
  - **Tag maintainer:** @baskaryan @hwchase17 @eyurtsev 
 
![cube_semantic_layer_agent](https://github.com/langchain-ai/langchain/assets/1825679/96778e49-6bf5-4ca7-906a-350092e77fb9)

<img width="1307" alt="ag" src="https://github.com/langchain-ai/langchain/assets/1825679/fbea9996-9eac-4a9c-baab-08ce74bbb3df">
Issue: `PDFMinerLoader` not gives `page` metadata when loading with `extract_images=False` - is it intended?
Labels: name: area: doc loader, name: auto:bug

### Issue you'd like to raise.

Unlike other PDF loaders, I've found that only the PDFMinerLoader doesn't provide pages in metadata when loading. Digging deeper, the PDFMinerParser only gives the page metadata when extract_images=True. I wonder if this was intentional.

### Suggestion:

#12277