SelfQueryRetriever broken with latest langchain-community or using ChatOpenAI as llm
Labels: name: auto:bug, name: area: models, name: integration: redis

### System Info

Python 3.11
langchain 0.0.352
langchain-core 0.1.3
langchain-community 0.0.4 (doesn't work with neithwer `from langchain.llms import OpenAI` nor `langchain.chat_models import ChatOpenAI`)
langchain-community 0.0.2 (works as expected with `from langchain.llms import OpenAI` but it doesn't with `langchain.chat_models import ChatOpenAI`)

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

### Reproduction

#### The following code works fine with `langchain-community 0.0.2`:

Plese refer to this [LangSmith run](https://smith.langchain.com/public/1c6c7960-e3b7-42fc-8835-6b78520e6580/r)

```import config
from langchain.vectorstores.redis import Redis
from langchain.retrievers.self_query.base import SelfQueryRetriever
from langchain.storage import RedisStore
from langchain.embeddings import OpenAIEmbeddings, CacheBackedEmbeddings
from langchain.chains.query_constructor.schema import AttributeInfo
from langchain.llms import OpenAI

embed_store = RedisStore(redis_url=config.REDIS_URL, client_kwargs={
    'db': 1}, namespace='embedding_cache')
underlying_embeddings = OpenAIEmbeddings()
embeddings = CacheBackedEmbeddings.from_bytes_store(
    underlying_embeddings, embed_store, namespace=underlying_embeddings.model
)

metadata_field_info = [
    AttributeInfo(
        name="source",
        description="The source URL or book title where the document comes from.",
        type="string",
    ),
    AttributeInfo(
        name="title",
        description="The title where the text was taken from. Use this attribute to filter the User Query, but don't filter for exact matches. For example: 'Qué dice el código de trabajo', the filter could be 'Código de Trabajo'; 'Qué dice la ley sobre el teletrabajo', the filter could be 'Teletrabajo'.",
        type="string",
    ),
    AttributeInfo(
        name="doc_type",
        description="Type of document classification to be used only as Filter for the User Query. Laws or Labor Code go under 'Legislación'. Company, Organizational or employer information go under 'Organización'. Company Policies go under 'Política'. Company internal procedures go under 'Procedimiento'.",
        type="string",
    ),
    AttributeInfo(
        name="keywords",
        description="A list of keywords taken from the document to filter the query. Always use this attribute to filter the query when a specific article number is needed. For example: 'Qué dice el artículo 10 del código de trabajo', you must capitalize the words 'articulo' to 'ARTÍCULO', and filter 'ARTÍCULO 10'.",
        type="string",
    ),
]

document_content_description = "Data source comprised of the entire contents of the Costa Rican Labor Code and other related Laws: 1) Código de trabajo; 2) Ley de protección al trabajador; 3) Ley de acoso sexual; 4) Ley de teletrabajo; y 5) Ley de Protección de Datos Personales."

llm = OpenAI(temperature=0.0)

rds_store = Redis.from_existing_index(
    embeddings,
    index_name=config.INDEX_NAME,
    redis_url=config.REDIS_URL,
    schema='./Redis_schema.yaml'
)

selfq_retriever = SelfQueryRetriever.from_llm(
    llm,
    rds_store,
    document_content_description,
    metadata_field_info,
    enable_limit=False,
    # verbose=True,
)

retriever = rds_store.as_retriever()
```

By just changing `from langchain.llms import OpenAI` to `from langchain.chat_models import ChatOpenAI` or by upgrading `langchain-community` to version 0.0.4, the query output is as follows and the retrieval doesn't work as intended:
```{
  "id": [
    "langchain",
    "chains",
    "query_constructor",
    "ir",
    "StructuredQuery"
  ],
  "lc": 1,
  "repr": "StructuredQuery(query='articulo 143', filter=Comparison(comparator=<Comparator.EQ: 'eq'>, attribute='title', value='Código de Trabajo'), limit=None)",
  "type": "not_implemented"
}
```
Plese refer to this [LangSmith run](https://smith.langchain.com/public/2d4732f0-8712-4e84-9af2-5d13ffc6cb93/r) for the unsuccessful retrieval


### Expected behavior

This is the expected result:
```{
  "id": [
    "langchain",
    "chains",
    "query_constructor",
    "ir",
    "StructuredQuery"
  ],
  "lc": 1,
  "repr": "StructuredQuery(query=' ', filter=Operation(operator=<Operator.AND: 'and'>, arguments=[Comparison(comparator=<Comparator.EQ: 'eq'>, attribute='title', value='Código de Trabajo'), Comparison(comparator=<Comparator.EQ: 'eq'>, attribute='doc_type', value='Legislación'), Comparison(comparator=<Comparator.EQ: 'eq'>, attribute='keywords', value='ARTÍCULO 143')]), limit=None)",
  "type": "not_implemented"
}
```