Langchain Agent Duplicates Response Separated by "\n" with Finetuned LLM
Labels: name: area: agent, name: auto:bug, name: area: models

### System Info

Running with `langchain==0.0.327` on Fedora Linux and Windows.
Finetuning with `gpt-3.5-turbo-16k-0613`.
Language: `Python 3.10.11`

### Who can help?

@hwchase17 @agola11

### Information

- [ ] The official example notebooks/scripts
- [X] 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
- [X] Agents / Agent Executors
- [ ] Tools / Toolkits
- [x] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

Hello, I have created a simple langchain agent with a Tool and with an LLM. However, the LLM passed into the agent actually points to my **finetuned** GPT instance. We notice that the output responses contain an accurate response, but repeated and separated by a newline.

I have [fine-tuned on the sample prompts](https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset) from the official OpenAI documentation on making a sarcastic chatbot. Here is the JSONL file I used for fine tuning: https://pastebin.com/BDV0Tjyk.

Here is my agent code:
```
    llm = ChatOpenAI(temperature=0, model=<OUR_MODEL_ID>, streaming=False)
    tools = [
        Tool.from_function(
            func=add_asdf,
            name="add_asdf",
            description="useful when someone asks to add asdf to a string.",
        ),
    ]
    agent_kwargs = {
        "system_message": SystemMessage(
            content="Marv is a factual chatbot that is also sarcastic."
        ),
    }
    agent = initialize_agent(
        tools,
        llm,
        agent=AgentType.OPENAI_FUNCTIONS,
        agent_kwargs=agent_kwargs,
        max_execution_time=90,
        early_stopping_method="generate",
        handle_parsing_errors=True,
        tags=[],
    )

    result = agent.run("Where's the sahara desert located?")
    print(result)
  ```

Now this does seem to work correctly and use the fine tuned instance (as we can see the responses are definitely sarcastic), but we notice that in its response, the agent seems to be combining **the same response twice, but separated by a newline.**

Output:
```
In North Africa. But who's keeping track of giant deserts anyway?
In North Africa. But who's keeping track of giant deserts anyway?
```

Looking at the generations from the debug:
```
  "generations": [
    [
      {
        "text": "In North Africa. But who's keeping track of giant deserts anyway?\nIn North Africa. But who's keeping track of giant deserts anyway?",
        "generation_info": {
          "finish_reason": "stop"
        },
        "type": "ChatGeneration",
        "message": {
          "lc": 1,
          "type": "constructor",
          "id": [
            "langchain",
            "schema",
            "messages",
            "AIMessage"
          ],
          "kwargs": {
            "content": "In North Africa. But who's keeping track of giant deserts anyway?\nIn North Africa. But who's keeping track of giant deserts anyway?",
            "additional_kwargs": {}
          }
        }
      }
    ]
  ]
```

Some important details:
- We notice that we only execute the LLM _one_ time (i.e. there are no duplicate runs of the llm in the chain).
- Our fine tuned instance works perfectly in the OpenAI playground, and with the OpenAI python library. **Hence, this seems to be a langchain-specific issue and nothing to do with our training data or fine tuning.**
- The issue does not occur 100% of the time. Occasionally, only one response is returned.

I am happy to provide more information on debug logs or anything about the fine-tuned model for replication. We'd love any information or nuances about using a fine-tuned instance with a Langchain agent, or guidance on what could be going wrong. Thanks!

### Expected behavior

Only one response should be generated:

```
In North Africa. But who's keeping track of giant deserts anyway?
```

The response contains a copy of the response separated by a newline:
```
{
  "output": "In North Africa. But who's keeping track of giant deserts anyway?\nIn North Africa. But who's keeping track of giant deserts anyway?"
}

```