microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
22.06k stars 3.29k forks source link

Python Notebook #3 Errors #5501

Closed kottofy closed 8 months ago

kottofy commented 8 months ago

Describe the bug Error occurs when running Python Notebook 3 when referencing AzureTextCompletion. This appears to be deprecated so maybe this notebook needs a refactor to use Chat Completion methods?

To Reproduce Steps to reproduce the behavior:

  1. Run 03-prompt-function-inline.ipynb with selectedService = Service.AzureOpenAI
  2. Get error on summary = await kernel.invoke(summarize, sk.KernelArguments(input=input_text))
Error occurred while invoking function summarizeFunc: Error occurred while invoking function summarizeFunc: ("<class 'semantic_kernel.connectors.ai.open_ai.services.azure_text_completion.AzureTextCompletion'> service failed to complete the prompt", BadRequestError("Error code: 400 - {'error': {'code': 'OperationNotSupported', 'message': 'The completion operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.'}}"))

Expected behavior Expect to get a response from the LLM

Screenshots image

Platform

kottofy commented 8 months ago

If I can get a thumbs up that the methods can be changed from Text Completions to Chat Completions, I'd be happy to make a PR.

eavanvalkenburg commented 8 months ago

So, what happens here is that in your env the deployment name is set to a gpt35turbo model, rather then a gpt35turboinstruct, the latter is a text completion model, the former isn't, so there are two ways to fix this, either change your env or indeed change the notebook to use chatcompletion classes. I think that should be fine (and openai is indeed moving away from completion in favor of chat completion), but haven't looked at that notebook for a while, so feel free to make a PR and if it works, it works!

moonbox3 commented 8 months ago

Hi @kottofy, as @eavanvalkenburg pointed out this looks to be a config issue. I tried to reproduce the error, but since my AzureOpenAI deployment is configured as gpt-35-turbo-instruct (the latest text completion model), it works. I am closing this since it is related to user configuration.