Azure / azure-functions-openai-extension

An extension that adds support for Azure OpenAI/ OpenAI bindings in Azure Functions for LLM (GPT-3.5-Turbo, GPT-4, etc)
MIT License
80 stars 29 forks source link

[Bug] Cannot start function with Python #82

Closed mdf-ido closed 5 months ago

mdf-ido commented 5 months ago

What language are you using?

Python

Expected Behavior

func start to start the function

Actual Behavior

Exception: AttributeError: 'FunctionApp' object has no attribute 'text_completion_input'

Host.json

Same as the example

Steps to Reproduce

  1. Edit the local settings.json
  2. func start --> Works with a simple HTTP function

Relevant code being tried

No response

Relevant log output

No response

Where are you facing this problem?

Local - Core Tools

Additional Information

No response

manvkaur commented 5 months ago

@hallvictoria , can you please check and see if we are missing something in our documentation.

hallvictoria commented 5 months ago

Hi @mdf-ido, can you install version 1.20.0b2 of azure-functions (pip install azure-functions==1.20.0b2) and add "PYTHON_ISOLATE_WORKER_DEPENDENCIES": "1" to your local.settings.json file? Please let me know if you're still experiencing this issue.

The decorators are a new change only in this version of azure-functions and above. The version brought in from core tools is older, so PYTHON_ISOLATE_WORKER_DEPENDENCIES=1 is necessary to pull from the user's azure-functions.

@manvkaur, we will need to add the azure-function installation step above to the documentation. I'll cut a PR for adding this step and adding PIWD=1 to local.settings.json. We can remove this when there's a core tools release with the worker bringing a library version of 1.20.0b2 or above, but I don't have an ETA for that right now.