delayedkarma/langchain-issues huggingface dataset:
In the "Dynamic Few-Shot Prompting" documentation, it is mentioned that when example_selector selects a sample for matching, it can cause the few-shot examples to lose effectiveness because the selected sample may not be relevant to the given input.
Labels: name: area: embeddings, name: auto:documentation, name: area: models, name: integration: chroma

### Issue with current documentation:

from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import Chroma
from langchain.chat_models import ChatOpenAI
from langchain.prompts import (
    FewShotChatMessagePromptTemplate,
    SemanticSimilarityExampleSelector,
    ChatPromptTemplate,
)

examples = [
    {"input": "2+2", "output": "4"},
    {"input": "2+3", "output": "5"},
    {"input": "2+4", "output": "6"},
    {"input": "What did the cow say to the moon?", "output": "nothing at all"},
    {
        "input": "Write me a poem about the moon",
        "output": "One for the moon, and one for me, who are we to talk about the moon?",
    },
]

example_selector = SemanticSimilarityExampleSelector.from_examples(
    examples,
    OpenAIEmbeddings(),
    Chroma,
    k=1
)

few_shot_prompt = FewShotChatMessagePromptTemplate(
    example_selector=example_selector,
    example_prompt=ChatPromptTemplate.from_messages(
        [("human", "{input}"), ("ai", "{output}")]
    ),
)

final_prompt = ChatPromptTemplate.from_messages(
    [
        ("system", "You are a wondrous wizard of math."),
        few_shot_prompt,
        ("human", "{input}"),
    ]
)

# 由于example_selector已经选择了一个样本进行匹配，这将导致少样本示例失效，因为选择的样本可能与给定的输入不相关。
print(final_prompt.format(input="What did the cow say to the moon?"))


### Idea or request for content:

In the "Dynamic Few-Shot Prompting" documentation, it is mentioned that when example_selector selects a sample for matching, it can cause the few-shot examples to lose effectiveness because the selected sample may not be relevant to the given input.

https://python.langchain.com/docs/modules/model_io/prompts/prompt_templates/few_shot_examples_chat#dynamic-few-shot-prompting
Add a new vector store hippo for langchain #11763
Labels: name: lgtm, name: area: vector store, name: auto:enhancement

Issue: #11763
Dependencies: N/A

I have run 'make format' 'make lint' and 'make test'

<!-- 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.
 -->
Use OpenAI ChatGPT Plugin via Python API fails with maximum number of tokens error
Labels: name: area: agent, name: auto:bug, name: area: models

### System Info

0.0.314

### Who can help?

@hwchase17 @agola11 @eyurtsev 

### 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
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
from langchain.chat_models import ChatOpenAI
from langchain.agents import load_tools, initialize_agent
from langchain.agents import AgentType
from langchain.tools import AIPluginTool

tool = AIPluginTool.from_plugin_url("https://scholar-ai.net/.well-known/ai-plugin.json")

llm = ChatOpenAI(temperature=0, streaming=True, model_name="gpt-3.5-turbo-16k-0613", max_tokens=16000)
tools = [tool]

agent_chain = initialize_agent(
    tools, llm, agent=AgentType.OPENAI_FUNCTIONS, verbose=True
)

agent_chain.run("What are the antiviral effects of Sillymarin?")
```

And I get 

```
InvalidRequestError: This model's maximum context length is 16385 tokens. However, you requested 17952 tokens (1855 in the messages, 97 in the functions, and 16000 in the completion). Please reduce the length of the messages, functions, or completion.
```

### Expected behavior

The idea is that should provide sensible information based on the Plugin Scholar AI.

It would be terrific, if you could help us here. 🙂
OpenAI API is extremely slow
Labels: name: auto:question, name: area: models

### System Info

LangChain Version: 0.0.314
Python 3.9.6

I have been using LangChain with OpenAI and FAISS for building RAG chatbots. Everything was working fine until last week. 
I have noticed that for some reason, I have much higher response times. I have debugged the LangChain code and found that the reason is the LLM response itself. I am using OpenAI GPT-3.5-turbo, I haven't changed anything in the prompt being sent, but response time has increased dramatically. For example, a very simple prompt in September took 2 seconds to generate. Now the exact same prompt takes up to 14 seconds to get a response!

Does anybody have the same experience? Does anybody know why this can be happening?
Any help will be appreciated!

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

1. Use OpenAI as an LLM
2. Observer response times

### Expected behavior

The LLM response should be much faster
Add LCEL to LLM intro
Labels: name: auto:documentation, 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.
 -->
Update chat model output type
Labels: name: lgtm, name: auto:improvement, 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.
 -->
Update README.md
Labels: name: auto:documentation

updated readme

<!-- 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.
 -->
directory_loader: Add "exclude_glob" option
Labels: name: area: doc loader, name: auto:improvement

Add an `exclude_glob` option to exclude some files or dirs from the main glob. Sample use case: a directory structure like this
```
main_directory/
    backup/ # Don't want to load from here
    file_directory_1/
    file_directory_2/
    ...
``` 
(inspired by [LogSeq](https://logseq.com/) data structure)
model_name is not passed as a argument to create method
Labels: name: auto:bug, name: area: models

https://github.com/langchain-ai/langchain/blob/a50630277295c3884be8e839b04718d0e99b4ea4/libs/langchain/langchain/chains/moderation.py#L93C43-L93C43

Code a line no. 93 needs to be updated as below
self.client.create(input = text, model = self.model_name)
return all documents in neo4j_vector
Labels: name: area: vector store, name: auto:enhancement, name: integration: chroma

### Feature request

similarly to: 

```
 db = Chroma(persist_directory=persist_directory, embedding_function=embeddings, client_settings=CHROMA_SETTINGS)
 collection = db.get()
```

where ```collection``` is a list of documents already in the vector store, is there a way to get that list from neo4j_vecror that was initialized from_documents() ?


### Motivation

This will allow to filter out existing documents when new ones are added in folder that is being used to build an expanding document vector store. 

### Your contribution

i was thinkging using .query() as a workaround but not sure how a CYPHER query can return all possible documents currently in the store.
Fix broken link on Retrievers state-of-the-union link
Labels: name: auto:documentation

Thanks for building Langchain. 

An small contribution: 

  - **Description:** Fix broken link for `modules/retrieval/retrievers` `state_of_the_union.txt` file in getting started section.  
  - **Issue:** the issue # it fixes (if applicable),
  - **Dependencies:** : N/A
  - **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below),
  - **Twitter handle:** @laura_uzcategui

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.
Issue: GPU is not used with Ctransformers even after specifying gpu_layers parameter
Labels: name: auto:bug, name: area: models

### Issue you'd like to raise.

I have installed langchain and ctransformer using -

```
pip install langchain
pip install ctransformers[cuda]
```

I am trying following piece of code -

```
from langchain.llms import CTransformers
config = {'max_new_tokens': 512, 'repetition_penalty': 1.1, 'context_length': 8000, 'temperature':0, 'gpu_layers':50}
llm = CTransformers(model = "./codellama-7b.Q4_0.gguf", model_type = "llama", gpu_layers=50, config=config)
```

Here gpu_layers parameter is specified still gpu is not being used and complete load is on cpu.
Can someone please point out if there is any step missing.

### Suggestion:

_No response_
Confluence document loader can not get the attachments
Labels: name: area: doc loader, name: auto:bug

### System Info

Python 3.11.5
langchain==0.0.260
atlassian-python-api==3.41.2

### Who can help?

@eyurtsev 
@hwchase17 

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

My code:
`data = loader.load(page_ids=[page_id], include_attachments=True, limit=50)`
Error message:
`requests.exceptions.HTTPError: 404 Client Error: Not Found for url: ...`

### Expected behavior

The problem is the URL path is not vaild (you can read my post at atlassian developer community [here ](https://community.developer.atlassian.com/t/download-confluence-content-attachment-via-rest-api-get-404-error/73782))

My solution:
at document_loaders/confluence.py [line 542](https://github.com/langchain-ai/langchain/blob/a50630277295c3884be8e839b04718d0e99b4ea4/libs/langchain/langchain/document_loaders/confluence.py#L542C6-L542C6)
change
`absolute_url = self.base_url + attachment["_links"]["download"]`
to 
`absolute_url = self.base_url + "/wiki" + attachment["_links"]["download"]`
ValidationError: 1 validation error for ChatMessage
Labels: name: area: doc loader, name: auto:bug, name: area: models

### System Info

window 、langchain-0.0.314、python 3.10

### Who can help?

_No response_

### 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

run

```
from langchain.chains.summarize import load_summarize_chain
from langchain.chat_models import ChatOpenAI
from langchain import LLMChain
from langchain.prompts.chat import (
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
)

api_base_url = "http://localhost:10860/v1" 
api_key= "EMPTY"
LLM_MODEL = "/***/AquilaChat2-7B"
model = ChatOpenAI(
    streaming=True,
    verbose=True,
    # callbacks=[callback],
    openai_api_key=api_key,
    openai_api_base=api_base_url,
    model_name=LLM_MODEL
)

 
chain = load_summarize_chain(model, 
                             chain_type="map_reduce",
                             verbose = True,
                             
                             )
 
output_summary = chain.run(docs[:5])
print(output_summary)

``

### Expected behavior

nomal

https://blog.csdn.net/FrenzyTechAI/article/details/131524746
Getting an error while importing MultiPromptChain
Labels: name: auto:bug, name: area: models

### System Info

Langchain version: 0.0.313
Python version: Python 3
OS: Mac


### Who can help?

@hwchase17


### Information

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

### Reproduction

from langchain.chains.router.multi_prompt import MultiPromptChain

Assume have already installed langchain and other necessary libraries

Error I get:
cannot import name 'BasePromptTemplate' from 'langchain.schema'. I checked in the langchain.schema file. BasePromptTemplate is indeed not there. But then I don't know how to get that file. I see PromptTemplate file in the langchain.schema file

### Expected behavior

To import MultiPromptChain
Issue: Getting Error while integrating confluence attachment
Labels: name: area: doc loader, name: auto:bug

### Issue you'd like to raise.

I'm encountering an error while trying to integrate confluenece attachment using the keyword "include_attachments=True", without these keyword I am able to do question answering on Text content.
But I want to fetch attachment of the confluence space. Below is my code:
![Screenshot from 2023-10-15 09-12-36](https://github.com/langchain-ai/langchain/assets/137885024/95d09e78-98bd-49cb-8adf-82f010dad9dd)
I encounter the following error:
![Screenshot from 2023-10-15 10-23-51](https://github.com/langchain-ai/langchain/assets/137885024/d111e219-e1d4-4f89-9657-fc52ff255f17)


### Suggestion:

_No response_
Issue: Getting Error while integrating confluence attachment
Labels: name: area: doc loader, name: auto:bug

### Issue you'd like to raise.

I'm encountering an error while trying to integrate confluenece attachment using the keyword "include_attachments=True", without these keyword I am able to do question answering on Text content.
But I want to fetch attachment of the confluence space. Below is my code:
![Screenshot from 2023-10-15 09-12-36](https://github.com/langchain-ai/langchain/assets/137885024/d7742e03-e67d-4108-bc3d-8cd632040bb2)
I encounter the following error:
![Screenshot from 2023-10-15 09-17-34](https://github.com/langchain-ai/langchain/assets/137885024/a0ed9deb-5663-4a8b-a854-ec5f163dd8e5)


### Suggestion:

_No response_
Issue: Similarity Search on Chroma does not retrieve relevant chunk for homogeneous document search
Labels: name: area: vector store, name: auto:question, name: auto:improvement, name: integration: chroma

### Issue you'd like to raise.

Hi, I have lots product factsheet in PDF format and would like to perform QnA on these documents. These documents have a common layout. I parsed these documents and stored them in ChromaDB. However, when I try to query the vector store for a specific details for ex. "What is the product category of product A?", it retrieved irrelevant chunks. What approach should be taken for such homogeneous documents QnA use cases?

### Suggestion:

_No response_
Create retriever for Outline to ask questions on knowledge base
Labels: name: area: doc loader, name: auto:enhancement

### Feature request

A retriever for documents from [Outline](https://github.com/outline/outline).

The API has a search endpoint which allows this to be possible: https://www.getoutline.com/developers#tag/Documents/paths/~1documents.search/post

The implementation will be similar to the Wikipedia retriever:
https://python.langchain.com/docs/integrations/retrievers/wikipedia

### Motivation

Outline is an open source project that let's you create a knowledge base, like a wiki. Creating a retriever for Outline will let your team interact with your knowledge base using an LLM.

### Your contribution

PR will be coming soon.
SQL DB Tools sql_db_schema bad input
Labels: name: auto:bug, name: area: models

### System Info

Langchain 0.0.314

When LLM returns with action input parameter without space in-between two tables, call fails. Certain LLMs dont follow "Table1, Table2" format and returns with "Table1,Table2"

This is  easily addressed by stripping out all spaces and split with ","

<code>
class InfoSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
    """Tool for getting metadata about a SQL database."""

    name: str = "sql_db_schema"
    description: str = """
    Input to this tool is a comma-separated list of tables, output is the schema and sample rows for those tables.    

    Example Input: "table1, table2, table3"
    """

    def _run(
        self,
        table_names: str,
        run_manager: Optional[CallbackManagerForToolRun] = None,
    ) -> str:
        """Get the schema for tables in a comma-separated list."""
        return self.db.get_table_info_no_throw(table_names.split(", "))
</code>

Replace return line with the following:
<code>
import re
.
.
.
def_run(
.
.
.
return self.db.get_table_info_no_throw(re.sub(" *","",table_names).split(","))
</code>

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

### Reproduction

This can be reproduced with Claude V2

### Expected behavior

sql_db_schema to not fail
Add support for many of the querying endpoints with serpapi
Labels: name: auto:enhancement

### Feature request

We propose the addition of some of the querying endpoints supported by serpapi that are not suported on langchain at the moment. Some examples, include querying google job, google trends and google finance etc.### 

### Motivation

The motivation for this feature proposal is to enhance the querying capabilities of Langchain by incorporating support for various querying endpoints provided by serpapi. The proposed feature aims to improve Langchain's querying capabilities by enabling users to interact with serpapi supported endpoints seamlessly.

### Your contribution

Me and 3 others intend to submit a pull request for this issue at some point in November for a school project. Looking forward to contributing.