You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Azure OpenAI service and therefore I am interested in getting this to work with litechain.
I tested this locally and it works without issues. I modified the OpenAIChatChain and added the required environment variables for the init method and engine parameter. Since there are no contribution guidelines yet, I am wondering now what's the best method to contribute? Should a AzureOpenAIChatChain inherit from OpenAIChatChain? If yes, this would probably mean that the additional arguments need to be passed to the parent class (similar to here).
Let me know how to move forward and I am happy to contribute.
The text was updated successfully, but these errors were encountered:
The solution with LiteLLM didn't work for me, I got this error:
'Delta' object has no attribute 'role'
So I wrote my own AzureOpenAIChatStream :
import importlib
from langstream.contrib import OpenAIChatStream
from typing import TypeVar
T = TypeVar("T")
U = TypeVar("U")
class AzureOpenAIChatStream(OpenAIChatStream[T, U]):
"""
PROBLEM:
The documented LiteLLMChatStream doesn't work as documented: https://rogeriochaves.github.io/langstream/docs/llms/lite_llm/
Probably it is some bug or smth, there was constantly an error 'Delta' object has no attribute 'role'
I create the AzureOpenAIChatStream class to override the original implementation,
so that I can use the AzureOpenAI client instead of the OpenAI client.
"""
_client_ = None
@staticmethod
def client():
"""
Returns the OpenAI client instance being used to make the LLM calls.
"""
if not AzureOpenAIChatStream._client_:
openai = importlib.import_module("openai")
AzureOpenAIChatStream._client_ = openai.AzureOpenAI()
return AzureOpenAIChatStream._client_
Hi,
I am using Azure OpenAI service and therefore I am interested in getting this to work with litechain.
I tested this locally and it works without issues. I modified the
OpenAIChatChain
and added the required environment variables for the init method andengine
parameter. Since there are no contribution guidelines yet, I am wondering now what's the best method to contribute? Should aAzureOpenAIChatChain
inherit fromOpenAIChatChain
? If yes, this would probably mean that the additional arguments need to be passed to the parent class (similar to here).Let me know how to move forward and I am happy to contribute.
The text was updated successfully, but these errors were encountered: