brainlid / langchain

Elixir implementation of an AI focused LangChain style framework.
https://hexdocs.pm/langchain/
Other
572 stars 68 forks source link

Add clause to match call_response spec #72

Closed medoror closed 7 months ago

medoror commented 7 months ago

Adds a clause to match an {:ok, Message.t()} payload according to the spec for the call function

Addresses #71

brainlid commented 7 months ago

Thanks @medoror! Sorry for the delay, been busy in other areas of life. I considered going a couple different directions with this, but ultimately opted for your direct solution. It's clean too.

I was wondering if the ChatModel should always return a message in a list, just to simplify and consolidate the return types. Then I wondered if the OpenAI implementation should actually NOT return a list. The only reason it does is because a caller can request "n" variations which come back in an array. I see no practical use for that though.

In the end, both of the other changes would be more invasive and dramatic and I'm not entirely sure yet which is the better way to go. So this solution works great. Thanks!

❤️💛💙💜