-
Checked other resources
Commit to Help
Example Codeimport os
from langchain_openai import AzureChatOpenAI
os.environ["AZURE_OPENAI_API_KEY"] = 'my-api-key'
os.environ["AZURE_OPENAI_ENDPOINT"] = 'https://my-endpoint.openai.azure.com'
os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"] = 'gpt-4o-mini-rag'
os.environ["AZURE_OPENAI_API_VERSION"] = '2024-07-18'
model = AzureChatOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
azure_deployment=os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"],
openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],
)
from langchain_core.messages import HumanMessage, SystemMessage
messages = [
SystemMessage(content="Translate the following from English into Italian"),
HumanMessage(content="hi!"),
]
model.invoke(messages) DescriptionHi all, I'm currently trying to do this LangChain tutorial with Azure OpenAI. This is the error message I receive: "NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}" This is how the configuration in Azure Studio looks like (including where I took the parameters from): I also tried the URL endpoint with "/openai" as suggested in another discussion here. But every time I receive the same error. :-/ System Infolangchain = 0.3.3 IDE: PyCharm Professional |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
Now I can answer my own question.
The API version on the deployment tab is wrong (see screenshot above).
When opening the "sample code" tab in the chat playground a different API version is shown:
So there is a missmatch between the deployment tab and chat playground.
I hope that this answer will help others in the future.