<#5126 [flyte-core] Flyte Connection> Pull request...
# flyte-github
c
#5126 [flyte-core] Flyte Connection Pull request opened by pingsutw on <!date^1711570202^{date_short}|2024-03-27T20:10:02Z> Tracking issue #3936 Why are the changes needed? It will allow users to pass different API_KEY to the chatGPT agent from flytepropeller What changes were proposed in this pull request? Agent client will read the secret from env or local file, and pass it to the agent server. How was this patch tested? local sandbox Setup process 1. Install flytekit and flyteidl pip install "git+https://github.com/flyteorg/flytekit.git@76dfef0c89615bb28dfa1ead932544150d9c2cde" pip install "git+https://github.com/flyteorg/flyte.git@d96975d0bc590b57e9205d81f4de9595a4bd1708#subdirectory=flyteidl" 1. Update local config Add below config to `flyte-single-binary-local.yaml`m and Add your API key to local env export FLYTE_SECRET_OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> externalResources: connections: chatgpt: secrets: openai_api_key: OPENAI_API_KEY configs: openai_organization: org-P2rdnZQry4Fw7Ak3vSpXEIrx 1. Run Flyte cluster locally cd flyte pyflyte serve agent make compile flyte start --config flyte-single-binary-local.yaml 1. Run a ChatGPT task pyflyte run --remote flyte-example/chatgpt_example.py my_chatgpt_job --message hello from flytekit import workflow, Secret from flytekitplugins.chatgpt import ChatGPTTask chatgpt_small_job = ChatGPTTask( name="3.5-turbo", openai_organization="org-P2rdnZQry4Fw7Ak3vSpXEIrx", connection="chatgpt", chatgpt_config={ "model": "gpt-3.5-turbo", "temperature": 0.7, }, ) @workflow def my_chatgpt_job(message: str) -> str: message = chatgpt_small_job(message=message) return message Screenshots Secret not found in propeller image image • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs flyteorg/flytekit#2297 Docs link NA flyteorg/flyte