delayedkarma/langchain-issues huggingface dataset:
Issue: The parameters passed by the OpenAI function agent seem to have a problem.
Labels: name: bug

### System Info

langchain 0.0.200 in Debian 11

### Who can help?

@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
- [ ] Memory
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Pydantic Model:
```py
class SortCondition(BaseModel):
    field: str = Field(description="Field name")
    order: str = Field(description="Sort order", enum=["desc", "asc"])


class RecordQueryCondition(BaseModel):
    datasheet_id: str = Field(description="The ID of the datasheet to retrieve records from.")
    filter_condition: Optional[Dict[str, str]] = Field(
        description="""
            Find records that meet specific conditions.
            This object should contain a key-value pair where the key is the field name and the value is the lookup value. For instance: {"title": "test"}.
            """
    )
    sort_condition: Optional[List[SortCondition]] = Field(min_items=1,
        description="Sort returned records by specific field"
    )
    maxRecords_condition: Optional[int] = Field(
        description="Limit the number of returned values."
    )
```

OpenAI return parameters:
```json
{
    "datasheet_id": "dsti6VpNpuKQpHVSnh",
    "sort_condition": [
        {
            "field": "Timestamp",
            "direction": "desc" # error key!
        }
    ],
    "maxRecords_condition": 1
}
```

So, LangChain raise a error: 
ValidationError: 1 validation error for RecordQueryCondition
sort_condition -> 0 -> order
  field required (type=value_error.missing)

This is source code: https://github.com/xukecheng/APITable-LLMs-Enhancement-Experiments/blob/main/apitable_langchain_function.ipynb

### Expected behavior

I use the OpenAI API to define functions, so it will work properly: https://github.com/xukecheng/APITable-LLMs-Enhancement-Experiments/blob/main/apitable_openai_function.ipynb
Update link in apis.mdx
Labels: name: lgtm

<!-- 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
 -->
The latest version langchain encountered errors when saving Chroma locally, "error "AttributeError: 'Collection' object has no attribute 'upsert'""
Labels: name: bug

### System Info

langchain 0.0.215 and langchain 0.0.216
python 3.9
chromadb 0.3.21

### Who can help?

@agola11 @hw

### Information

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

### Related Components

- [X] LLMs/Chat Models
- [X] 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

from langchain.vectorstores import Chroma
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.llms import OpenAI
from langchain.chains import VectorDBQA
from langchain.document_loaders import TextLoader
from langchain.embeddings import HuggingFaceEmbeddings, HuggingFaceInstructEmbeddings

loader = TextLoader('state_of_the_union.txt')
documents = loader.load()

text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_documents(documents)

persist_directory = 'db'
embedding = HuggingFaceInstructEmbeddings(model_name=“hkunlp/instructor-large”)
vectordb = Chroma.from_documents(documents=documents, embedding=embedding, persist_directory=persist_directory)
vectordb.persist()
vectordb = None

[state_of_the_union.txt](https://github.com/hwchase17/langchain/files/11879392/state_of_the_union.txt)

The detail error information is attached as follows,
[error_info.txt](https://github.com/hwchase17/langchain/files/11879458/error_info.txt)
I don't know why there will be a error "AttributeError: 'Collection' object has no attribute 'upsert'"

And when i degrade the langchain version to 0.0.177, everything go back normal


### Expected behavior

The document could be stored locally for the further retrieval.
Support kwargs on GoogleSearchApiWrapper run / result 
Labels: name: enhancement, name: good first issue

### Feature request

Would you please consider supporting kwargs in GoogleSearchApiWrapper's run / result call,
https://python.langchain.com/docs/modules/agents/tools/integrations/google_search

for the extra filtering on search. for example, I'd like to add "cr" option in cse search, but it seems that I cannot pass any options to run / result method, although internal function "_google_search_results" supports passing extra option to search engine.


### Motivation

I'd like to add "cr" option in cse search, but it seems that I cannot pass any options to run / result method, although internal function "_google_search_results" supports passing extra option to search engine.

### Your contribution

If you allow me, I'd like to make pr for this change.
feat: add model architecture back to wandb tracer
Labels: name: lgtm

# Description

This PR adds model architecture to the `WandbTracer` from the Serialized Run kwargs. This allows visualization of the calling parameters of an Agent, LLM and Tool in Weights & Biases. 
    1. Safely serialize the run objects to WBTraceTree model_dict
    2. Refactors the run processing logic to be more organized.

- Tag maintainer: @agola11
- Twitter handle: @parambharat
load_qa_chain with chain_type="map_reduce" can not process long document
Labels: name: bug, name: question

### System Info

langchain version: 0.0.215
python version: Python 3.8.8

### Who can help?

@hwchase17 @agola11 @ey

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

### Reproduction

I take the example from https://python.langchain.com/docs/modules/chains/additional/question_answering#the-map_reduce-chain . I ignore the retrieval part and inject the whole document into `load_qa_chain` with set `chain_type="map_reduce"`：
```
from langchain.document_loaders import TextLoader
from langchain.chains.question_answering import load_qa_chain
from langchain.llms import OpenAI

loader = TextLoader("state_of_the_union.txt")
documents = loader.load()

chain = load_qa_chain(OpenAI(temperature=0), chain_type="map_reduce")
query = "What did the president say about Justice Breyer"
chain({"input_documents": documents, "question": query}, return_only_outputs=True)
```
comes error below:
```
InvalidRequestError: This model's maximum context length is 4097 tokens, however you requested 9640 tokens (9384 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.
```
when `documents` is long document, set `chain_type="map_reduce"` seems do not work, why and  how to solve it? 
Thanks a lot!

### Expected behavior

 load_qa_chain with `chain_type="map_reduce"` setting  should can process long document directly，does it？
ValueError: RedisCache only supports caching of normal LLM generations, got <class 'langchain.schema.ChatGeneration'>
Labels: name: bug

### System Info

Python 3.10, Langchain > v0.0.212

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

Enable caching with langchain.llm_cache = RedisCache

### Expected behavior

This works with version <= v0.0.212
Source info in map_rerank's answer
Labels: name: enhancement, name: needs documentation

### Feature request

Have SOURCES info in map_rerank's answer similar to the information available for 'map_reduce' and 'stuff' chain_type options.

### Motivation

Standardization of output
Indicate answer source when map-rerank is used with ConversationalRetrievalChain

### Your contribution

https://github.com/hwchase17/langchain/pull/6794
Web Loader: Add proxy support

Proxies are helpful, especially when you start querying against more anti-bot websites.

[Proxy services](https://developers.oxylabs.io/advanced-proxy-solutions/web-unblocker/making-requests) (of which there are many) and `requests` make it easy to rotate IPs to prevent banning by just passing along a simple dict to `requests`.

CC @rlancemartin, @eyurtsev
add async to zapier nla tools
Labels: name: lgtm

Replace this comment with:
  - Description: Add Async functionality to Zapier NLA Tools
  - Issue:  n/a 
  - Dependencies: n/a
  - Tag maintainer: 

Maintainer responsibilities:
  - Agents / Tools / Toolkits: @vowelparrot
  - 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
Initial Streamlit callback integration doc (md)

**Description:** Add a documentation page for the Streamlit Callback Handler integration (#6315)

Notes:
- Implemented as a markdown file instead of a notebook since example code runs in a Streamlit app (happy to discuss / consider alternatives now or later)
- Contains an embedded Streamlit app -> https://mrkl-minimal.streamlit.app/ Currently this app is hosted out of a Streamlit repo but we're working to migrate the code to a LangChain owned repo

![streamlit_docs](https://github.com/hwchase17/langchain/assets/116604821/0b7a6239-361f-470c-8539-f22c40098d1a)

cc @dev2049 @tconkling
Update arize_callback.py - bug fix

  - Description: Bug Fix - Added a step variable to keep track of prompts
  - Issue: Bug from internal Arize testing - The prompts and responses that are ingested were not mapped correctly
  - Dependencies: N/A

 @hwchase17
  - Agents / Tools / Toolkits: @vowelparrot
  - Tracing / Callbacks: @agola11
  - Async: @agola11
Zapier update oauth support

Description: Update documentation to

1) point to updated documentation links at Zapier.com (we've revamped our help docs and paths), and
2) To provide clarity how to use the wrapper with an access token for OAuth support

Demo:

Initializing the Zapier Wrapper with an OAuth Access Token

`ZapierNLAWrapper(zapier_nla_oauth_access_token="<redacted>")`

Using LangChain to resolve the current weather in Vancouver BC leveraging Zapier NLA to lookup weather by coords.

```
> Entering new  chain...
 I need to use a tool to get the current weather.
Action: The Weather: Get Current Weather
Action Input: Get the current weather for Vancouver BC
Observation: {"coord__lon": -123.1207, "coord__lat": 49.2827, "weather": [{"id": 802, "main": "Clouds", "description": "scattered clouds", "icon": "03d", "icon_url": "http://openweathermap.org/img/wn/03d@2x.png"}], "weather[]icon_url": ["http://openweathermap.org/img/wn/03d@2x.png"], "weather[]icon": ["03d"], "weather[]id": [802], "weather[]description": ["scattered clouds"], "weather[]main": ["Clouds"], "base": "stations", "main__temp": 71.69, "main__feels_like": 71.56, "main__temp_min": 67.64, "main__temp_max": 76.39, "main__pressure": 1015, "main__humidity": 64, "visibility": 10000, "wind__speed": 3, "wind__deg": 155, "wind__gust": 11.01, "clouds__all": 41, "dt": 1687806607, "sys__type": 2, "sys__id": 2011597, "sys__country": "CA", "sys__sunrise": 1687781297, "sys__sunset": 1687839730, "timezone": -25200, "id": 6173331, "name": "Vancouver", "cod": 200, "summary": "scattered clouds", "_zap_search_was_found_status": true}
Thought: I now know the current weather in Vancouver BC.
Final Answer: The current weather in Vancouver BC is scattered clouds with a temperature of 71.69 and wind speed of 3
```
Request to Support other VertexAI's LLM model Support
Labels: name: enhancement

### Feature request

Right now only `text-bison` model is support by Google PaLM. When tried `code-bison` its throwing below error:
```
---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[39], line 1
----> 1 llm = VertexAI(model_name='code-bison')

File /opt/conda/envs/python310/lib/python3.10/site-packages/pydantic/main.py:341, in pydantic.main.BaseModel.__init__()

ValidationError: 1 validation error for VertexAI
__root__
  Unknown model publishers/google/models/code-bison; {'gs://google-cloud-aiplatform/schema/predict/instance/text_generation_1.0.0.yaml': <class 'vertexai.language_models._language_models._PreviewTextGenerationModel'>} (type=value_error)
```

Can we get other model supports as well?

### Motivation

Support for many other PaLM models

### Your contribution

I can update and test the code for different other models
Verbose flag not outputting anything other than Entering chain and Finished chain
Labels: name: bug

### System Info

langchain==0.0.216 (I have had this since i started with Langchain (198)
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
- [x] Callbacks/Tracing
- [ ] Async

### Reproduction

I run this function with 

```json
{
 "prompt": "some prompt",
 "temperature": 0.2
}
```

```python3

from typing import Any

from langchain.chains import RetrievalQAWithSourcesChain
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.prompts import PromptTemplate

from app.config.api_keys import ApiKeys
from app.repositories.pgvector_repository import PGVectorRepository


def completions_service(data) -> dict[str, Any]:
    pgvector = PGVectorRepository().instance

    tech_template = """Some prompt info (redacted)

        {summaries}

        Q: {question}
        A: """
    prompt_template = PromptTemplate(
        template=tech_template, input_variables=["summaries", "question"]
    )

    qa = RetrievalQAWithSourcesChain.from_chain_type(llm=ChatOpenAI(temperature=data['temperature'],
                                                                    model_name="gpt-3.5-turbo",
                                                                    openai_api_key=ApiKeys.openai),
                                                     chain_type="stuff",
                                                     retriever=pgvector.as_retriever(),
                                                     chain_type_kwargs={"prompt": prompt_template},
                                                     return_source_documents=True,
                                                     verbose=True,
                                                     )

    output = qa({"question": data['prompt']})

    return output
```

I get this in the command line
```bash


> Entering new  chain...

> Finished chain.

```

For some reason, there is a double space in the Entering line (as if there is meant to be something there) and then nothing until it says finish, I have set verbose = True but not luck

### Expected behavior

I would expect to see the embeddings, the full prompt being sent to openai etc. but I get nothing.
Add tools description to OpenAI Multi Function request, and skip function call when there is no actions provided.
Labels: name: area: agent, name: auto:improvement

## Description 
- Add tools description to OpenAI Multi-Function request, to provide more context on what the tool does.
- Skip function call to break the infinite loop of agent on continuously trying to perform `function_call` with empty `actions` /`tools` array.  

## Tag Maintainer
@dev2049 @vowelparrot

## Twitter handle 
ZhiHaoLow
Fix inconsistent logging_and_data_dir parameter in AwaDB
Labels: name: lgtm

## Description

Tag maintainer: @rlancemartin, @eyurtsev 

### log_and_data_dir
`AwaDB.__init__()` accepts a parameter named `log_and_data_dir`. But `AwaDB.from_texts()` and `AwaDB.from_documents()` accept a parameter named `logging_and_data_dir`. This inconsistency in this parameter name can lead to confusion on the part of the caller.

This PR renames `logging_and_data_dir` to `log_and_data_dir` to make all functions consistent with the constructor.

### embedding

`AwaDB.__init__()` accepts a parameter named `embedding_model`. But `AwaDB.from_texts()` and `AwaDB.from_documents()` accept a parameter named `embeddings`. This inconsistency in this parameter name can lead to confusion on the part of the caller.

This PR renames `embedding_model` to `embeddings` to make AwaDB's constructor consistent with the classmethod "constructors" as specified by `VectorStore` abstract base class.
Fix for #6696 : Added persist_directory to client_settings if persist_directory is not None in Chroma
Labels: name: area: vector store, name: auto:bug

Description:
1. Fixed an issue in Chroma Integration : Add persist_directory to client_settings if persist_directory is not None.
2. Added Tests for chroma integration to test persistence with client_settings.
Issue: https://github.com/hwchase17/langchain/issues/6696
Maintainers :  @dev2049 @eyurtsev @rlancemartin
Add concurrent insertion of vector rows in the Cassandra Vector Store

Using the newest `cassIO`, the Cassandra Vector Store can now perform concurrent DB insertion in its `add_texts` method, hence improving its performance.

#### Linter unrelated errors

Running the linter, the following (likely unrelated) was observed:

```
langchain/vectorstores/mongodb_atlas.py:137: error: Argument 1 to "insert_many" of "Collection" has incompatible type "List[Dict[str, Sequence[object]]]"; expected "Iterable[Union[MongoDBDocumentType, RawBSONDocument]]"  [arg-type]
langchain/vectorstores/mongodb_atlas.py:186: error: Argument 1 to "aggregate" of "Collection" has incompatible type "List[object]"; expected "Sequence[Mapping[str, Any]]"  [arg-type]
langchain/vectorstores/qdrant.py: error: Name "grpc" is not defined  [name-defined]
```

Happy to be pointed at a fix, if the above is somehow caused by the code in this PR!
fix(memory): allow internal chains to use memory

<!-- 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
 -->

Fixed #6768.

This is a workaround only. I think a better longer-term solution is for chains to declare how many input variables they *actually* need (as opposed to ones that are in the prompt, where some may be satisfied by the memory). Then, a wrapping chain can check the input match against the actual input variables.

@hwchase17
Can't use memory for an internal LLMChain inside a SequentialChain
Labels: name: bug, name: enhancement

### System Info

Langchain 0.0.214
Python 3.11.1

### Who can help?

@hwchase17 

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

### Reproduction

1. Create a `SequentialChain` that contains 2 `LLMChain`s, and add a memory to the first one.
2. When running, you'll get a validation error: 
```
Missing required input keys: {'chat_history'}, only had {'human_input'} (type=value_error)
```

### Expected behavior

You should be able to add memory to one chain, not just the Sequential Chain
Issue: Qdrant does not support the vector_size parameter, which is a very common and frequently used parameter. I hope it can be supported.
Labels: name: enhancement

### Issue you'd like to raise.

Qdrant does not support the vector_size parameter, which is a very common and frequently used parameter. I hope it can be supported.

langchain/vectorstores/qdrant.py

```
# Just do a single quick embedding to get vector size
   partial_embeddings = embedding.embed_documents(texts[:1])
   vector_size = len(partial_embeddings[0])
```





### Suggestion:

I hope it can be supported.