I am getting " RetryError[<Future at 0x14a6faca740 state=finished raised APIConnectionError>]"

Test 0 Reputation points
2024-04-15T16:38:40.47+00:00

While I try to run a code in Python that is used to run on PYRIT framework, I am getting the below error. I am not able to fix this

RetryError[<Future at 0x14a6ca740 state=finished raised APIConnectionError>]

Code: Taken from PYRIT github

import os
import uuid
import traceback
from pyrit.common import default_values
from pyrit.prompt_target import AzureOpenAIChatTarget
default_values.load_default_env()
try:
    with AzureOpenAIChatTarget(
        deployment_name=os.environ.get("AZURE_OPENAI_CHATDEPLOYMENT"),
        endpoint=os.environ.get("AZURE_OPENAI_CHATENDPOINT"),
        api_key=os.environ.get("AZURE_OPENAI_CHATKEY"),
    ) as target_llm:
        prompt = "test"
        target_llm.send_prompt(normalized_prompt=prompt, conversation_id=str(uuid.uuid4()), normalizer_id=None)
except Exception as e:
    print("An exception occurred:", e)
    traceback.print_exc()
Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
723 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,198 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,402 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 42,286 Reputation points Microsoft Employee
    2024-04-16T07:00:16.3133333+00:00

    @Test Could you add an issue at Pyrit github repo? Seems like an error from AzureOpenAIChatTarget while accessing your endpoint.

    You might want to check using CURL if the endpoint is directly accessible and then print the values from above code before passing to the target for debugging. If the values are correct and it still fails, then there might be issue with the connect setup by pyrit. Thanks!!

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments