Open Viper911 opened 3 weeks ago
I thought it might be as easy as updating the llm_manager. I have a different program that uses this connection, but it uses openai library rather than langchain sp not sure if this how I would update.
class OpenAIModel(AIModel): def init(self, api_key: str, llm_model: str):
##--self.model = ChatOpenAI(model_name=llm_model, openai_api_key=api_key,
## temperature=0.4)
from langchain_openai import AzureChatOpenAI
self.model = AzureChatOpenAI(
azure_endpoint = ENDPOINT,
azure_deployment = DEPLOYMENT,
api_version = API_VERSION,
api_key = AZURE_API_KEY,
temperature=0.4
)
def invoke(self, prompt: str) -> BaseMessage:
logger.debug("Invoking OpenAI API")
response = self.model.invoke(prompt)
return response
Got a little closure. Seems I have to use langchain.chat_models
from langchain.chat_models import AzureChatOpenAI
self.model = AzureChatOpenAI(
deployment_name=DEPLOYMENT,
openai_api_base=ENDPOINT,
openai_api_version=API_VERSION,
openai_api_key=AZURE_API_KEY
)
Now I get: 2024-10-26 12:39:30.876 | ERROR | src.llm.llm_manager:parse_llmresult:391 - Unexpected error while parsing LLM result: 'NoneType' object has no attribute 'get' 2024-10-26 12:39:30.877 | ERROR | src.llm.llm_manager:call:332 - Unexpected error occurred: 'NoneType' object has no attribute 'get' 2024-10-26 12:39:30.877 | INFO | src.llm.llm_manager:call:333 - Waiting for 30 seconds before retrying due to an unexpected error.
from langchain_openai import AzureChatOpenAI
self.model = AzureChatOpenAI(
model=llm_model,
api_key=API_KEY,
base_url=ENDPOINT,
api_version=API_VERSION,
temperature=0.4
)
This works
Yea, I have been able to get connection now. There is just a bunch of places in code that need to be updated. For example the token stats dont work with Azure and the resume builder has connection strings in it that seem like they need to be updated. In any case, I haven;t had time to work through them all so it still doesn't work, but am slowly trying.
From: Jasar-k @.> Sent: Tuesday, October 29, 2024 2:53 PM To: feder-cr/Auto_Jobs_Applier_AIHawk @.> Cc: Viper911 @.>; Assign @.> Subject: Re: [feder-cr/Auto_Jobs_Applier_AIHawk] [FEATURE]: Add Azure OpenAI (Issue #616)
from langchain_openai import AzureChatOpenAI self.model = AzureChatOpenAI( model=llm_model, api_key=API_KEY, base_url=ENDPOINT, api_version=API_VERSION, temperature=0.4 ) This works
— Reply to this email directly, view it on GitHubhttps://github.com/feder-cr/Auto_Jobs_Applier_AIHawk/issues/616#issuecomment-2445086333, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAYWZ2MANFIWATKDFVFVT53Z57KT7AVCNFSM6AAAAABQU4GVW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBVGA4DMMZTGM. You are receiving this because you were assigned.Message ID: @.***>
I made support on this feature #847
Feature summary
Add Azure OpenAI
Feature description
Can you add LLM to use Azure OpenAI?
Motivation
I get free credits with MSDN subscription
Alternatives considered
No response
Additional context
No response