langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

OpenAPIChat can't get the usage from LLMResult

Open YikaJ opened this issue 1 year ago • 2 comments

const callbackManager = CallbackManager.fromHandlers({
  handleLLMEnd: async (output: LLMResult) => {
    console.log(JSON.stringify(output, null, 2));
  },
  handleLLMError: async (err: Error) => {
    console.error(err);
  },
})
new OpenAIChat({
  // ...other
  callbackManager
});

when I look at console, not return llmOutputs image

It's seem had been fixed it #332 , BUT not works in latest version.

YikaJ avatar Apr 13 '23 13:04 YikaJ

EXPECTED: image

YikaJ avatar Apr 13 '23 13:04 YikaJ

OpenAIChat and ChatOpenAI are diffrent:

  • OpenAIChat is a language model.
  • ChatOpenAI is a chat model. (Chat models use language models under the hood).

I think only ChatOpenAI added this feature.

suyingtao avatar Apr 15 '23 16:04 suyingtao

Hi, @YikaJ! I'm here to help the LangChain team manage their backlog, and I wanted to let you know that we are marking this issue as stale.

From what I understand, you reported an issue with OpenAPIChat where it was unable to retrieve usage from the LLMResult. This issue was previously fixed in version #332, but it seems to not be working in the latest version. You provided an expected image of the result, and Suyingtao clarified that OpenAIChat and ChatOpenAI are different, with ChatOpenAI being a chat model that uses language models under the hood. They mentioned that only ChatOpenAI added this feature.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain project, and please don't hesitate to reach out if you have any further questions or concerns!

dosubot[bot] avatar Aug 18 '23 16:08 dosubot[bot]