delayedkarma/langchain-issues huggingface dataset:
Issue: I am trying to turn this function into a tool how should i do it?
Labels: name: auto:question

### Issue you'd like to raise.

this is the function 
```
from datetime import datetime
from typing import Optional, Union
from os import environ
from gcsa.google_calendar import GoogleCalendar
from gcsa.recurrence import Recurrence, YEARLY, DAILY, WEEKLY, MONTHLY
from gcsa.event import Event
from langchain.callbacks.manager import (
    AsyncCallbackManagerForToolRun,
    CallbackManagerForToolRun,
)



def add_event_to_calender(
    summary: str,
    start: datetime,
    end: Union[datetime, None],
) -> None:
    GOOGLE_EMAIL = environ.get('GOOGLE_EMAIL')
    CREDENTIALS_PATH = environ.get('CREDENTIALS_PATH')

    calendar = GoogleCalendar(
        GOOGLE_EMAIL, 
        credentials_path=CREDENTIALS_PATH
        )
    date_time_format = '%Y-%m-%dT%H:%M:%S'

    event = Event(
        summary=summary, 
        start=datetime.strptime(start,date_time_format), 
        end=datetime.strptime(end,date_time_format)
        )
    calendar.add_event(event)


    GOOGLE_EMAIL = environ.get('GOOGLE_EMAIL')
    CREDENTIALS_PATH = environ.get('CREDENTIALS_PATH')

    calendar = GoogleCalendar(
        GOOGLE_EMAIL, 
        credentials_path=CREDENTIALS_PATH
        )
    date_time_format = '%Y-%m-%dT%H:%M:%S'

    event = Event(
        summary=summary, 
        start=datetime.strptime(start,date_time_format), 
        end=datetime.strptime(end,date_time_format)
        )
    calendar.add_event(event)
```


### Suggestion:

_No response_
Add AsyncExecutor class
Labels: name: auto:enhancement

<!-- 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/hwchase17/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.
 -->
mongodb doc loader init
Labels: name: auto:enhancement

  - **Description:** A Document Loader for MongoDB
  - **Issue:** n/a
  - **Dependencies:** Motor, the async driver for MongoDB
  - **Tag maintainer:** n/a
  - **Twitter handle:** pigpenblue

Note that an initial mongodb document loader was created 4 months ago, but the [PR ](https://github.com/langchain-ai/langchain/pull/4285)was never pulled in.  @leo-gan had commented on that PR, but given it is extremely far behind the master branch and a ton has changed in Langchain since then (including repo name and structure), I rewrote the branch and issued a new PR with the expectation that the old one can be closed.

Please reference that old PR for comments/context, but it can be closed in favor of this one.  Thanks!
Issue : Unable to set max_output_tokens for VertexAI models
Labels: name: auto:bug, name: area: models

### System Info

I am using VertexAI model to parse data in a document. Since the documents are large, I am trying to increase the max_output_tokens parameter for "chat-bison-32k" model. I am not able to change this parameter and my output gets truncated after a certain token limit is reached. Is there a way to increase the output token limit? 

The output also has a " ```JSON" tag at the beginning which is not desired @

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

model = ChatVertexAI(model_name=model_name,
                            max_output_tokens = 2400,
                            temperature=0.01)

example_gen_chain = LLMChain(llm=chat, prompt=prompt)

def generate_examples(generator, data):
    return generator.apply_and_parse(data)

# Loop through each text to parse it
for i, item in enumerate(texts, start=1):
    
    text = item
    new_example = generate_examples(
        example_gen_chain, [{"doc": text}]
    )

### Expected behavior

The output gets truncated when the token limit is reached.

 ```JSON
{
  "sections": [
    {
      "SectionNumber": "1",
      "SectionName": "Product",
      "Body": "Body of the document.",
    },
    {
      "
chat_models.QianfanEndpoint Not Compatiable with SystemMessage
Labels: name: auto:bug, name: area: models

### System Info

langchain version:0.0.291
Platform: linux
python version: 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
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

1. Use `chat_models.QianfanEndpoint` with the Message Below:
```python
[
SystemMessage(content="you are an AI Assistant...."),
HumanMessage(content="who are you")
]


```
2. then raise the `TypeError`

### Expected behavior

The SystemMessage could be handled correctly.
fix: chat_models Qianfan not compatiable with SystemMessage
Labels: name: auto:bug, name: area: models

  - **Description:** QianfanEndpoint bugs for SystemMessages. When the `SystemMessage` is input as the messages to `chat_models.QianfanEndpoint`. A `TypeError` will be raised.
  - **Issue:** #10643
  - **Dependencies:** 
  - **Tag maintainer:** @baskaryan
  - **Twitter handle:** no
fix: Lemon AI Analytics broken link
Labels: name: lgtm, name: auto:documentation

**Description**

The [current redirect link](https://github.com/felixbrock/lemonai-analytics) gives 404 error replace it with the  [correct link](https://github.com/felixbrock/lemon-agent/blob/main/apps/analytics/README.md)

Resource: https://python.langchain.com/docs/integrations/tools/lemonai
Support new version of tiktoken that are working with langchain (tag "^0.3.2" => "">=0.3.2,<0.6.0" and python "^3.9" =>">=3.9")
Labels: name: auto:improvement

  - **Description:**
       be able to use langchain with other version than tiktoken 0.3.3 i.e 0.5.1
  - **Issue:**
      cannot installed the conda-forge version since it applied all optional dependency:
       https://github.com/conda-forge/langchain-feedstock/pull/85  
      replace "^0.3.2" by "">=0.3.2,<0.6.0" and "^3.9" by  python=">=3.9"  
      Tested with python 3.10, langchain=0.0.288 and tiktoken==0.5.0  

- **Clarification**:
    The langchain package on pypi have only the mandatory dependencies. Is there another one with all optional dependencies and similar to have is done in conda-forge ? Before I saw langchain[all]  but doesn't seems to exist anymore.
When I use a prompt with "{", I get an error
Labels: name: auto:bug

### Issue you'd like to raise.

Error message:
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for PromptTemplate
__root__
  Format specifier missing precision (type=value_error)

My prompt looks like this:
I want you to generate results in json format like :{"key1":... , "key2":.... , "key3":... ,... }


### Suggestion:

_No response_
Share ThreadPoolExecutor for entire computation graph of a Runnable call
Labels: name: auto:improvement

<!-- 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/hwchase17/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.
 -->
Add missing dep in lcel cookbook
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/hwchase17/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: Asks SQLDatabaseChain to return specific columns. Let the main question fail.
Labels: name: auto:improvement, name: area: models

### Issue you'd like to raise.

## Description
I use the Chinook database as an example.

![image](https://github.com/langchain-ai/langchain/assets/91650059/200c3663-f0e0-4cc3-98be-fcad39dff38c)

I will create a AI customer service system.
The user provides the trackid and question.
In addition to providing answers, the system will also provide track, album and artist information for the trackid.

For examples:

[Question]
[Answer]
[Fixed information]

Q: Help me check the selling price of trackid 1024.
A: The selling price of trackid 1024 is $0.99.
- Track ID: 1024
- Song: Wind Up
- Album: The Colour And The Shape
- Artist: Foo Fighters

## Build chain
```
from langchain.chat_models import ChatOpenAI
from langchain.utilities import SQLDatabase
from langchain_experimental.sql import SQLDatabaseChain

db = SQLDatabase.from_uri(
    "sqlite:///Chinook.db",
    include_tables=["Track", "Album", "Artist"],
)

llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo", verbose=True)

db_chain = SQLDatabaseChain.from_llm(llm, db, use_query_checker=True, verbose=True)
```

## Case 1
+ Input
```
db_chain.run("Help me check the selling price of trackid 1024.")
```
+ Output
```
> Entering new SQLDatabaseChain chain...
Help me check the selling price of trackid 1024.
SQLQuery:SELECT "UnitPrice" FROM "Track" WHERE "TrackId" = 1024;
SQLResult: [(0.99,)]
Answer:Final answer here: The selling price of trackid 1024 is $0.99.
> Finished chain.
```
+ Explain
```
Just ask for answers.
Get the right answer.
```

## Case 2
+ Input
```
db_chain.run(
    "Help me check the selling price of trackid 1024, and use markdown items to list track.id, track.name, albums.title, and artist.name."
)
```
+ Output
```
> Entering new SQLDatabaseChain chain...
Help me check the selling price of trackid 1024, and use markdown items to list track.id, track.name, albums.title, and artist.name.
SQLQuery:SELECT "Track"."TrackId", "Track"."Name", "Album"."Title", "Artist"."Name"
FROM "Track"
JOIN "Album" ON "Track"."AlbumId" = "Album"."AlbumId"
JOIN "Artist" ON "Album"."ArtistId" = "Artist"."ArtistId"
WHERE "Track"."TrackId" = 1024
SQLResult: [(1024, 'Wind Up', 'The Colour And The Shape', 'Foo Fighters')]
Answer:The selling price of trackid 1024 is not provided in the given tables.
> Finished chain.
```
+ Explain
```
Ask for answers and fixed information at the same time.
LLM will pay attention to the fixed information.
Forget the most important question of asking about price.
```

### Suggestion:

Hope `SQLDatabaseChain` supports returning fixed infomation for specific relational columns.
Sagemaker Endpoint cross account capability
Labels: name: auto:enhancement, name: integration: aws

### Feature request

SagemakerEndpoint should be capable of assuming cross account role or have a way to inject the boto3 session

### Motivation

SagemakerEndpoint currently can run with credentials available but to call sagemaker endpoints in different account there is no way to inject boto3 session or role information which can assumed internally.

### Your contribution

Will try to raise a PR and help to test it.
age power error
Labels: name: auto:bug, name: auto:improvement, name: area: models

### System Info

If this error occurs, it is recommended to set the logic for requesting again.

![image](https://github.com/langchain-ai/langchain/assets/52407961/96ead28c-27f4-4ed4-9b25-8fe30534582c)

![image](https://github.com/langchain-ai/langchain/assets/52407961/f81f4875-10e6-46de-8559-f727cf421291)



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

### Reproduction

希望有更好的代码

### Expected behavior

- Code optimization
Fix typo in google_vertex_ai_palm.ipynb
Labels: name: lgtm, name: auto:documentation

seperate -> separate

<!-- 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/hwchase17/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: Remove "AI:" and "Human:" prefixes in memory history
Labels: name: area: memory, name: auto:improvement

### Issue you'd like to raise.

Hi,
I am trying to make a chatbot with a LLM based on LLaMa2.
When I use the memory (ConversationBufferWindowMemory), it creates a default prompt like:
"""
    Human: input
    AI: output
    Human: input
"""
However, with LLaMa2 I need to create a prompt like:
"""
    
 {input} 

    {output}
    
 {input} 

"""
I discovered that I can change the "Human" and "AI" prefixes, but I can’t delete the ":", so I am getting:
"""
    : 
 {input} 

    : {output}
    : 
 {input} 

"""
Is there any way I can modify the whole prefix?
Thanks

### Suggestion:

_No response_
Add **kwargs to Langchain's dumps() to allow passing of json.dumps() …
Labels: name: area: doc loader, name: auto:improvement, name: size:S

…parameters.

In Langchain's `dumps()` function, I've added a `**kwargs` parameter. This allows users to pass additional parameters to the underlying `json.dumps()` function, providing greater flexibility and control over JSON serialization.

Many parameters available in `json.dumps()` can be useful or even necessary in specific situations. For example, when using an Agent with return_intermediate_steps set to true, the output is a list of AgentAction objects. These objects can't be serialized without using Langchain's `dumps()` function.

The issue arises when using the Agent with a language other than English, which may contain non-ASCII characters like 'é'. The default behavior of `json.dumps()` sets ensure_ascii to true, converting `{"name": "José"}` into `{"name": "Jos\u00e9"}`. This can make the output hard to read, especially in the case of intermediate steps in agent logs.

By allowing users to pass additional parameters to `json.dumps()` via Langchain's dumps(), we can solve this problem. For instance, users can set `ensure_ascii=False` to maintain the original characters.

This update also enables users to pass other useful `json.dumps()` parameters like `sort_keys`, providing even more flexibility.

The implementation takes into account edge cases where a user might pass a "default" parameter, which is already defined by `dumps()`, or an "indent" parameter, which is also predefined if `pretty=True` is set.
Allow calls to batch() with 0 length arrays
Labels: name: auto:nit

This can happen if eg the input to batch is a list generated dynamically, where a 0-length list might be a valid use case

<!-- 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/hwchase17/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.
 -->
ValueError: Could not parse LLM output: difference between ConversationalAgent and ConversationalChatAgent  
Labels: name: area: agent, name: auto:bug, name: auto:question, name: area: models

### System Info

langchain 0.0.291


### 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
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I am getting parsing error (  ` raise OutputParserException(
langchain.schema.output_parser.OutputParserException: Could not parse LLM output:`) if I initialized an agent as: 

```
chat_agent = ConversationalAgent.from_llm_and_tools(llm=llm, tools=tools)
executor = AgentExecutor.from_agent_and_tools(
                                                      agent=chat_agent,
                                                      tools=tools,
                                                      memory=memory,
                                                      return_intermediate_steps=True,
                                                      handle_parsing_errors=True,
                                                      verbose=True,
                                                  )
```


But no error if I use ConversationalChatAgent instead:
```
chat_agent = ConversationalChatAgent.from_llm_and_tools(llm=llm, tools=tools)
executor = AgentExecutor.from_agent_and_tools(
                                                      agent=chat_agent,
                                                      tools=tools,
                                                      memory=memory,
                                                      return_intermediate_steps=True,
                                                      handle_parsing_errors=True,
                                                      verbose=True,
                                                  )
```

### Expected behavior

Why do we have two same agents and one does not work?
Change text tracking for aim callback "on_chain_start", "on_chain_end"
Labels: name: bug, name: auto:improvement

**Description:** 
 The previous behaviour was causing an error, because the keys input resp. output did not exist in the passed parameters inputs resp. outputs.

Now, all keys are tracked in aim as texts and from the input_documents, the page content is tracked.

Additionally the structure of the tracking is more useful for getting an overview of the run.

**Issue:** new version of pull request 6161
**Dependencies:** aim
**Tag maintainer:** @leo-gan 
**Twitter handle:** no
TypeError: Got unknown type F
Labels: name: auto:bug, name: area: models

### System Info

langchain-0.0.291
python3.9

### Who can help?

_No response_

### Information

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

### Related Components

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

### Reproduction

```
import os
import openai
openai.api_type = "azure"
openai.api_base = os.getenv("OPENAI_API_BASE")
openai.api_version = "version"
openai.api_key = os.getenv("OPENAI_API_KEY")
DEPLOYMENT_NAME = 'deployment name
from langchain.chat_models import AzureChatOpenAI
llm = AzureChatOpenAI(
    openai_api_base=os.getenv("OPENAI_API_BASE"),
    openai_api_version="version",
    deployment_name=DEPLOYMENT_NAME,
    openai_api_key=os.getenv("OPENAI_API_KEY"),
    openai_api_type="azure",
    temperature=0.0
)

result = llm("Father of computer")
print(result)
```

### Expected behavior

Expecting the answer