File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11import base64
22from enum import Enum
3-
43from urllib .parse import urlparse
4+
55import httpx
66from pydantic import BaseModel
77
@@ -161,11 +161,13 @@ def parse_http_spec(http_spec: str) -> LLMSpec:
161161 method , url = lines [0 ].split (" " )[0 :2 ]
162162
163163 # Check url validity
164- valid_url = urlparse (url )
165- # if missing the correct formatting ://, urlparse.netloc will be empty
166- if valid_url .scheme not in ("http" , "https" ) or not valid_url .netloc :
167- raise InvalidHTTPSpecError (f"Invalid URL: { url } . Ensure it starts with 'http://' or 'https://'" )
168-
164+ valid_url = urlparse (url )
165+ # if missing the correct formatting ://, urlparse.netloc will be empty
166+ if valid_url .scheme not in ("http" , "https" ) or not valid_url .netloc :
167+ raise InvalidHTTPSpecError (
168+ f"Invalid URL: { url } . Ensure it starts with 'http://' or 'https://'"
169+ )
170+
169171 # Initialize headers and body
170172 headers = {}
171173 body = ""
Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ def update_rewards(
121121 current_prompt : str ,
122122 reward : float ,
123123 passed_guard : bool ,
124- ) -> None : ...
124+ ) -> None :
125+ ...
125126
126127
127128class QLearningPromptSelector (PromptSelectionInterface ):
You can’t perform that action at this time.
0 commit comments