An example of using the Dapr AI bindings as language models in langchain.
- Python 3.10 or later
- Dapr 1.10 or later
- Langchain 0.0.137 or later
- Dapr AI Bindings
The Dapr AI bindings assume you have created an Azure Open AI instance in Azure and deployed a language model named gpt-4
. To use another language model service, update the ./resources/ai.yaml
in the example folder.
-
Add Azure Open AI endpoint and key to a
secrets.json
file in the root of the repo{ "azure-open-ai-endpoint": "<Azure Open AI endpoint>", "azure-open-ai-key": "<Azure Open AI key>", }
-
Start the Dapr AI bindings pluggable component
cd <dapr-ai-bindings source>/src/DaprAi.Components dotnet run
-
Start the Dapr sidecar
dapr run --app-id daprai --dapr-grpc-port 50001 --resources-path ./resources
-
Start the Python module
python3 main.py
-
Observe the output:
Rainbow Steps
Due to variability in the language model response, you might get a different (but hopefully still inventive) answer.