Unverified Commit 57272b63 authored by Samuel Monson's avatar Samuel Monson Committed by GitHub
Browse files

Add verify_certificate argument to local-completion (#2440)

parent b40a20ae
...@@ -91,6 +91,10 @@ When initializing a `TemplateAPI` instance or a subclass, you can provide severa ...@@ -91,6 +91,10 @@ When initializing a `TemplateAPI` instance or a subclass, you can provide severa
- Custom token ID to use as a prefix for inputs. - Custom token ID to use as a prefix for inputs.
- If not provided, uses the model's default BOS or EOS token (if `add_bos_token` is True). - If not provided, uses the model's default BOS or EOS token (if `add_bos_token` is True).
- `verify_certificate` (bool, optional):
- Whether to validate the certificate of the API endpoint (if HTTPS).
- Default is True.
Example usage: Example usage:
......
...@@ -79,6 +79,7 @@ class TemplateAPI(TemplateLM): ...@@ -79,6 +79,7 @@ class TemplateAPI(TemplateLM):
trust_remote_code: bool = False, trust_remote_code: bool = False,
revision: Optional[str] = "main", revision: Optional[str] = "main",
use_fast_tokenizer: bool = True, use_fast_tokenizer: bool = True,
verify_certificate: bool = True,
**kwargs, **kwargs,
) -> None: ) -> None:
super().__init__() super().__init__()
...@@ -120,6 +121,7 @@ class TemplateAPI(TemplateLM): ...@@ -120,6 +121,7 @@ class TemplateAPI(TemplateLM):
self.custom_prefix_token_id = custom_prefix_token_id self.custom_prefix_token_id = custom_prefix_token_id
self.tokenized_requests = tokenized_requests self.tokenized_requests = tokenized_requests
self.max_retries = int(max_retries) self.max_retries = int(max_retries)
self.verify_certificate = verify_certificate
eval_logger.info(f"Using tokenizer {self.tokenizer_backend}") eval_logger.info(f"Using tokenizer {self.tokenizer_backend}")
if self.tokenizer_backend is None: if self.tokenizer_backend is None:
...@@ -342,6 +344,7 @@ class TemplateAPI(TemplateLM): ...@@ -342,6 +344,7 @@ class TemplateAPI(TemplateLM):
**kwargs, **kwargs,
), ),
headers=self.header, headers=self.header,
verify=self.verify_certificate,
) )
if not response.ok: if not response.ok:
eval_logger.warning( eval_logger.warning(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment