Skip to content

Parameters on raw HTTP Target #824

Open
@herick-santos-ey

Description

@herick-santos-ey

Hi,

I was trying to make a connection to the http prompt target but I was unsuccessful, because I noticed that the raw_http_request did not take my header field (user-uuid) which was placed differently than passed in the documentation, for this case, I am not using the api-key to access my LLM.

I leave here a tip for you in the future to allow different fields to be passed as header of the request.

I tried to pass the parameter directly in the OpenAIChatTarget call but I was also unsuccessful.

The api under the url is working because I've tested it in other applications (swagger and postman) and using the requests library as well.

At the end of it all, the most I could get was a 404 error. of not found for not being able to pass this parameter.

Error:

HTTPStatusError: Client error '404 Not Found' for url 'http://acs-assist-benchmark-llm.nia.hm.bb.com.br/chatCompletion'

raw request:

raw_http_request = f"""
POST {url}
Content-Type: application/json
user-uuid: {user_uuid}

{{
    "data": {{
        "solicitacao": {{
            "messages": [
                {{
                        "role": "user",
                    "content": "{{prompt}}"
                }}
            ]
        }},
        "config": {{
            "temperature": 0.2,
            "max_tokens": 256,
            "top_p": 0.95
        }}
    }}
}}

"""

calling the headers directly

red_teaming_chat = OpenAIChatTarget(api_version=None, headers={"user-uuid": "some_number"})

scorer = SelfAskTrueFalseScorer(
chat_target=OpenAIChatTarget(api_version=None, headers={"user-uuid": "some_number"}),
true_false_question_path=Path("classifiers/check_fraud_classifier.yaml"),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions