delayedkarma/langchain-issues huggingface dataset:
`EmbeddingRouterChain.from_names_and_descriptions`  doesn't accept vectorstore kwargs
Labels: name: bug, name: enhancement

### System Info

Ubuntu 22.04.2
Python 3.10.11
langchain 0.0.215

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

### Reproduction

```python
from pathlib import Path

from langchain.chains.router.embedding_router import EmbeddingRouterChain
from langchain.embeddings import LlamaCppEmbeddings
from langchain.vectorstores import Weaviate

model_dir = Path.home() / 'models'
llama_path = model_dir / 'llama-7b.ggmlv3.q4_0.bin'
encoder = LlamaCppEmbeddings(model_path=str(llama_path))
encoder.client.verbose = False
names_and_descriptions = [
    ("physics", ["for questions about physics"]),
    ("math", ["for questions about math"]),
]
router_chain = EmbeddingRouterChain.from_names_and_descriptions(names_and_descriptions, Weaviate, encoder,
                                                                weaviate_url='http://localhost:8080',
                                                                routing_keys=["input"])
```

### Expected behavior

I expect to be able to configure the underlying vectorizer with kwargs passed into the `from_names_and_descriptions` e.g. `weaviate_url`
ConversationBufferMemory fails to capture OpenAI functions messages in LLMChain
Labels: name: bug, name: enhancement

### System Info

Adding memory to a LLMChain with OpenAI functions enabled fails because of `AIMessage` are generated instead of `FunctionMessage`

```python
    self.add_message(AIMessage(content=message))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pas/development/advanced-stack/sandbox/sublime-plugin-maker/venv/lib/python3.11/site-packages/langchain/load/serializable.py", line 74, in __init__
    super().__init__(**kwargs)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for AIMessage
content
  str type expected (type=type_error.str)
```

where `AIMessage.content` is in fact a dict.


Tested version : `0.0.215`



### Who can help?

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

### Reproduction

1. Create a LLMChain with both functions and memory
2. Enjoy :)

### Expected behavior

When LLMChain is created with `functions` and memory, generate FunctionMessage and accept dict (or json dumps)
AzureChatOpenAI: InvalidRequestError
Labels: name: bug

### System Info

Windows 11,
python==3.10.5
langchain==0.0.215
openai==0.27.8
faiss-cpu==1.7.4

### Who can help?
@zeke 
@sbusso 
@deepblue 
when run this example code: 
https://python.langchain.com/docs/modules/model_io/models/chat/integrations/azure_chat_openai
I get the following error...

"InvalidRequestError: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."

The code works if you downgrade langchain to 0.0.132

### Information

- [X] 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

Follow the instructions in the notebook.
https://python.langchain.com/docs/modules/model_io/models/chat/integrations/azure_chat_openai

### Expected behavior

Get a response.
vectorstores/faiss.py load_local can't set normalize_L2
Labels: name: bug, name: enhancement

https://github.com/hwchase17/langchain/blob/1742db0c3076772db652c747df1524cd07695f51/langchain/vectorstores/faiss.py#L458
this from method can set 'normalize_L2' for un-norm embeddings

https://github.com/hwchase17/langchain/blob/1742db0c3076772db652c747df1524cd07695f51/langchain/vectorstores/faiss.py#L588

but load_local no 'normalize_L2' argument, so cache&load cant't work as expected

please add 'normalize_L2'，or cache 'normalize_L2' to cache_file and restore it when load_local
Recent tags change causes AttributeError: 'str' object has no attribute 'value' on initialize_agent call
Labels: name: bug

### System Info

- Langchain: 0.0.215
- Platform: ubuntu
- Python 3.10.12

### Who can help?

@vowelparrot 

https://github.com/hwchase17/langchain/blob/d84a3bcf7ab3edf8fe1d49083e066d51c9b5f621/langchain/agents/initialize.py#L54



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

Fails if agent initialized as follows:
```python
agent = initialize_agent(
        agent='zero-shot-react-description',
        tools=tools,
        llm=llm,
        verbose=True,
        max_iterations=30,
        memory=ConversationBufferMemory(),
        handle_parsing_errors=True)
```
With
```
...
lib/python3.10/site-packages/langchain/agents/initialize.py", line 54, in initialize_agent
    tags_.append(agent.value)
AttributeError: 'str' object has no attribute 'value'
````

### Expected behavior

Expected to work as before where agent is specified as a string (or if this is highlighting that agent should actually be an object, it should indicate that instead of the error being shown).
`RetrievalQAWithSourcesChain` with `max_tokens_limit` throws error `Requested tokens exceed context window`
Labels: name: bug, name: needs documentation

### System Info

Ubuntu 22.04.2
Python 3.10.11
langchain 0.0.215

### Who can help?

_No response_

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

```python
from pathlib import Path

from langchain import LlamaCpp
from langchain.callbacks.manager import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain.chains import RetrievalQAWithSourcesChain
from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.embeddings import LlamaCppEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Weaviate

model_dir = Path.home() / 'models'
llama_path = model_dir / 'llama-7b.ggmlv3.q4_0.bin'
assert llama_path.exists()
encoder = LlamaCppEmbeddings(model_path=str(llama_path))
encoder.client.verbose = False
readme_path = Path(__file__).parent.parent / 'README.md'
loader = UnstructuredMarkdownLoader(str(readme_path))
data = loader.load()
text_splitter = CharacterTextSplitter(
    separator="\n\n",
    chunk_size=10,
    chunk_overlap=2,
    length_function=len,
)
texts = text_splitter.split_documents(data)
db = Weaviate.from_documents(texts, encoder, weaviate_url='http://localhost:8080', by_text=False)
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
llm = LlamaCpp(model_path=str(llama_path), temperature=0, callback_manager=callback_manager, stop=[], verbose=False)
llm.client.verbose = False
chain = RetrievalQAWithSourcesChain.from_chain_type(llm, chain_type="stuff", retriever=db.as_retriever(),
                                                    reduce_k_below_max_tokens=True, max_tokens_limit=512)
query = "How do I install this package?"
chain({"question": query})
```

### Expected behavior

When setting `max_tokens_limit` I expect it to be the limit for the final prompt passed to the llm
Seeing this error message is very confusing after checking that the question and loaded source documents do not reach the token limit
When `BaseQAWithSourcesChain.from_llm` is called, it uses a long `combine_prompt_template` by default, which in the case of LlamaCpp is already over the token limit
I would expect `max_tokens_limit` to apply to the full prompt, or to receive an error message explaining that the limit was breached because of the template, and ideally an example of how to alter the template
path_params and url format not work
Labels: name: bug

### System Info

Python 3.9.6

_**Requirement**_

aiohttp==3.8.4
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
certifi==2023.5.7
charset-normalizer==3.1.0
dataclasses-json==0.5.8
docopt==0.6.2
frozenlist==1.3.3
idna==3.4
langchain==0.0.215
langchainplus-sdk==0.0.17
marshmallow==3.19.0
marshmallow-enum==1.5.1
multidict==6.0.4
mypy-extensions==1.0.0
numexpr==2.8.4
numpy==1.25.0
openai==0.27.8
openapi-schema-pydantic==1.2.4
packaging==23.1
pipreqs==0.4.13
pydantic==1.10.9
PyYAML==6.0
requests==2.31.0
SQLAlchemy==2.0.17
tenacity==8.2.2
tqdm==4.65.0
typing-inspect==0.9.0
typing_extensions==4.6.3
urllib3==2.0.3
yarg==0.1.9
yarl==1.9.2


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

### Reproduction

Endpoint:

**URL**: https://api.gopluslabs.io//api/v1/token_security/{chain_id}
**arguments**:
<img width="593" alt="image" src="https://github.com/hwchase17/langchain/assets/24714804/b2d1226d-2d0b-45d8-9400-7f420d463f38">

In openapi.py: 160
<img width="596" alt="image" src="https://github.com/hwchase17/langchain/assets/24714804/06d70353-47de-4e32-90c3-7f5f6c316047">
After the _format_url, url doesn't change, the result of printer is also https://api.gopluslabs.io//api/v1/token_security/{chain_id}


### Expected behavior

Expect URL and path parameters to be properly combined after formatting like:
**https://api.gopluslabs.io//api/v1/token_security/1**
Weaviate.from_documents throws PosixPath is not JSON serializable when documents loaded via Pathlib
Labels: name: bug

### System Info

Ubuntu 22.04.2
Python 3.10.11
langchain 0.0.215

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

```python
from pathlib import Path

from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.embeddings import LlamaCppEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Weaviate

model_dir = Path.home() / 'models'
llama_path = model_dir / 'llama-7b.ggmlv3.q4_0.bin'
encoder = LlamaCppEmbeddings(model_path=str(llama_path))
readme_path = Path(__file__).parent.parent / 'README.md'
loader = UnstructuredMarkdownLoader(readme_path)
data = loader.load()
text_splitter = CharacterTextSplitter(
    separator="\n\n",
    chunk_size=10,
    chunk_overlap=2,
    length_function=len,
)
texts = text_splitter.split_documents(data)
db = Weaviate.from_documents(texts, encoder, weaviate_url='http://localhost:8080', by_text=False)
```

### Expected behavior

The `UnstructuredMarkdownLoader` loads the metadata as a `PosixPath` object
`Weaviate.from_documents` then throws an error because it can't post this metadata, as `PosixPath` is not serializable
If I change `loader = UnstructuredMarkdownLoader(readme_path)` to `loader = UnstructuredMarkdownLoader(str(readme_path))` then the metadata is loaded as a string, and the posting to Weaviate works

I would expect `UnstructuredMarkdownLoader` to have the same behaviour when I pass it a string or a path like object
I would expect Weaviate to handle serialising a path like object to a string
Issue: ConversationBufferMemory stopped working
Labels: name: bug, name: question

Hello everyone. 
Oddly enough, I've recently run into a problem with memory. 
In the first version, I had no issues, but now it has stopped working. It's as though my agent has Alzheimer's disease. 
Does anyone have any suggestions as to why it might have stopped working? 
There doesn't seem to be any error message or any apparent reason. Thank you!

I already tried reinstalling chromedb.


```
def agent(tools):
    llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")
    agent_kwargs = {
    "user name is bob": [MessagesPlaceholder(variable_name="chat_history")],
    }
    template = """This is a conversation between a human and a bot:

    {chat_history}

    Write a summary of the conversation for {input}:
    """

    prompt = PromptTemplate(input_variables=["input", "chat_history"], template=template)
    memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
    #agent_chain = initialize_agent(tools, llm, agent=AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION, verbose=True, memory=memory)
    agent_chain=initialize_agent(tools, llm, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, prompt = prompt, verbose=True, agent_kwargs=agent_kwargs, memory=memory, max_iterations=5, early_stopping_method="generate")
    return agent_chain
```

Perhaps this error is realated

´´´
WARNING:root:Failed to load default session, using empty session: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Failed to load default session, using empty session: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

´´´

´´´
WARNING:root:Failed to persist run: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /chain-runs (Caused by NewConnectionError('<urllib3.connectio
n.HTTPConnection object at 0x7f1458a82770>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                              Failed to persist run: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /chain-runs (Caused by NewConnectionError('<urllib3.connection.HTTPConnect
ion object at 0x7f1458a82770>: Failed to establish a new connection: [Errno 111] Connection refused'))                                                                           I'm sorry, but I don't have access to personal information.


´´´
Issue: Entity extraction using custom rules
Labels: name: enhancement, name: question

### Issue you'd like to raise.

I would like to perform a query on a database using natural language. However, running direct queries is not possible, and I have to do it via an API. For that, given a sentence, I'd like to extract some custom entities from it. 

For example, if the sentence is: "How many more than 20 years old male users viewed a page or logged in in the last 30 days?"
The entities are:
```
<gender, equals, male>,
<age, greater than, 20>,
<event name, equals, view page>,
<event name, equals, login>,
<event timestamp, more than, 30 days>
```

The first element of each entity (triplet) comes from the list of columns
The second element is inferred from context (nature of the operator if it's a single value or array to compare with)
The third element is also inferred from the context and must belong to the chosen column (first element)

I'm not able to restrict either of these elements for the entity. I'd like an agent first to check all the columns that are available, choose one and view their unique values. Once it gets that, either choose that column (first element) and value (third element) or look again and repeat these steps.

Any help on this would be great!

### Suggestion:

_No response_
LLM中文应用交流微信群
Labels: name: invalid



LLM中文应用和技术交流群，如果二维码过期可加微信备注LLM应用：yydsa0007

![9cfa9a394442162b466b747db86b5c9](https://github.com/hwchase17/langchain/assets/90118245/27869c08-69aa-4cea-9a6b-f54ba020e9d2)
SitemapLoader is not working verify error from module
Labels: name: bug

### System Info

langchain version i got from 
!pip install langchain

import nest_asyncio
nest_asyncio.apply()

from langchain.document_loaders.sitemap import SitemapLoader

SitemapLoader.requests_per_second = 2
# Optional: avoid `[SSL: CERTIFICATE_VERIFY_FAILED]` issue
#SitemapLoader.requests_kwargs = {'verify':True}
loader = SitemapLoader(
    "https://www.infoblox.com/sitemap_index.xml",
)
docs = loader.load()  #this is where it fails it works with version



TypeError                                 Traceback (most recent call last)
[<ipython-input-5-609988fd11f7>](https://localhost:8080/#) in <cell line: 13>()
     11     "https://www.infoblox.com/sitemap_index.xml",
     12 )
---> 13 docs = loader.load()

2 frames
[/usr/local/lib/python3.10/dist-packages/langchain/document_loaders/web_base.py](https://localhost:8080/#) in _scrape(self, url, parser)
    186         self._check_parser(parser)
    187 
--> 188         html_doc = self.session.get(url, verify=self.verify, **self.requests_kwargs)
    189         html_doc.encoding = html_doc.apparent_encoding
    190         return BeautifulSoup(html_doc.text, parser)

TypeError: requests.sessions.Session.get() got multiple values for keyword argument 'verify'


#this was working in older version
!pip install langchain==0.0.189

thanks
nick

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

### Reproduction

follow the code above

### Expected behavior

it should run not crash
id type in SupabaseVectorStore doesn't match SQL column
Labels: name: bug

### System Info

LangChain version: 0.0.214

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

### Reproduction

Same as [Supabase docs](https://python.langchain.com/docs/modules/data_connection/vectorstores/integrations/supabase) with the exact table and function created, where `id` column has type of bigint.

```Python
from supabase.client import Client, create_client
from langchain.embeddings import OpenAIEmbeddings
from langchain.document_loaders import TextLoader
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import SupabaseVectorStore

loader = TextLoader("../../../state_of_the_union.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)

embeddings = OpenAIEmbeddings()

supabase_client: Client = create_client(
    supabase_url=os.getenv("SUPABASE_URL"),
    supabase_key=os.getenv("SUPABASE_SERVICE_KEY"),
)

supabase_vector_store = SupabaseVectorStore.from_documents(
    documents=docs,
    client=supabase_client,
    embedding=embeddings,
)
```

Got
> APIError: {'code': '22P02', 'details': None, 'hint': None, 'message': 'invalid input syntax for type bigint: "64f03aff-0c0e-4f24-91e2-e01fcaxxxxxx"'}

### Expected behavior

Successfully insert and embed the split docs into Supabase.


To be helpful, I believe it was introduced by [this commit](https://github.com/hwchase17/langchain/commit/be02572d586bcb33fffe89c37b81d5ba26762bec) regarding the List[str] type `ids`. But not sure if it was intended with docs not updated yet, or otherwise.
AttributeError: 'OpenAI' object has no attribute 'predict'
Labels: name: bug, name: documentation

### System Info

Langchain Version: 0.0.74
openai Version: 0.27.8



### Who can help?

_No response_

### Information

- [X] 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

from langchain.llms import OpenAI 
llm = OpenAI(openai_api_key=INSERT_API_KEY, temperature=0.9)
llm.predict("What would be a good company name for a company that makes colorful socks?")


### Expected behavior

I was following the langchain quickstart guide, expected to see something similar to the output.
20230626

<!-- 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!

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: @dev2049
  - DataLoaders / VectorStores / Retrievers: @rlancemartin, @eyurtsev
  - Models / Prompts: @hwchase17, @dev2049
  - Memory: @hwchase17
  - Agents / Tools / Toolkits: @vowelparrot
  - 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
 -->