How to resolve - 'AIMessage' object is not subscriptable error

Annie George 0 Reputation points
2023-11-09T05:03:30.9933333+00:00

Tried to run azure chat openai via langchain but we got this error. User's image

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,392 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,140 Reputation points MVP
    2023-11-09T05:20:08.4133333+00:00

    Check where in your code the 'AI Message' object is being used with square brackets. Look for lines that are trying to access elements like ai_message[some_index] or ai_message["some_key"]

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.