fix: incorrect Perplexity API parameter names (#9278)
Co-authored-by: Arvydas Jonusonis <arvydas@jonusonis.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This commit is contained in:
parent
bbb0838dda
commit
43812ceda6
2 changed files with 5 additions and 16 deletions
|
|
@ -29,9 +29,8 @@ You can toggle parameters through the <Icon name="SlidersHorizontal" aria-hidden
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|------|------|-------------|
|
|------|------|-------------|
|
||||||
| model_name | String | Input parameter. The name of the Perplexity model to use. Options include various Llama 3.1 models. |
|
| model_name | String | Input parameter. The name of the Perplexity model to use. Options include various Llama 3.1 models. |
|
||||||
| max_output_tokens | Integer | Input parameter. The maximum number of tokens to generate. |
|
| max_tokens | Integer | Input parameter. The maximum number of tokens to generate. |
|
||||||
| api_key | SecretString | Input parameter. The Perplexity API Key for authentication. |
|
| api_key | SecretString | Input parameter. The Perplexity API Key for authentication. |
|
||||||
| temperature | Float | Input parameter. Controls randomness in the output. Default: 0.75. |
|
| temperature | Float | Input parameter. Controls randomness in the output. Default: 0.75. |
|
||||||
| top_p | Float | Input parameter. The maximum cumulative probability of tokens to consider when sampling (advanced). |
|
| top_p | Float | Input parameter. The maximum cumulative probability of tokens to consider when sampling (advanced). |
|
||||||
| n | Integer | Input parameter. Number of chat completions to generate for each prompt (advanced). |
|
| n | Integer | Input parameter. Number of chat completions to generate for each prompt (advanced). |
|
||||||
| top_k | Integer | Input parameter. Number of top tokens to consider for top-k sampling. Must be positive (advanced). |
|
|
||||||
|
|
@ -31,9 +31,7 @@ class PerplexityComponent(LCModelComponent):
|
||||||
],
|
],
|
||||||
value="llama-3.1-sonar-small-128k-online",
|
value="llama-3.1-sonar-small-128k-online",
|
||||||
),
|
),
|
||||||
IntInput(
|
IntInput(name="max_tokens", display_name="Max Output Tokens", info="The maximum number of tokens to generate."),
|
||||||
name="max_output_tokens", display_name="Max Output Tokens", info="The maximum number of tokens to generate."
|
|
||||||
),
|
|
||||||
SecretStrInput(
|
SecretStrInput(
|
||||||
name="api_key",
|
name="api_key",
|
||||||
display_name="Perplexity API Key",
|
display_name="Perplexity API Key",
|
||||||
|
|
@ -57,20 +55,13 @@ class PerplexityComponent(LCModelComponent):
|
||||||
"Note that the API may not return the full n completions if duplicates are generated.",
|
"Note that the API may not return the full n completions if duplicates are generated.",
|
||||||
advanced=True,
|
advanced=True,
|
||||||
),
|
),
|
||||||
IntInput(
|
|
||||||
name="top_k",
|
|
||||||
display_name="Top K",
|
|
||||||
info="Decode using top-k sampling: consider the set of top_k most probable tokens. Must be positive.",
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def build_model(self) -> LanguageModel: # type: ignore[type-var]
|
def build_model(self) -> LanguageModel: # type: ignore[type-var]
|
||||||
api_key = SecretStr(self.api_key).get_secret_value()
|
api_key = SecretStr(self.api_key).get_secret_value()
|
||||||
temperature = self.temperature
|
temperature = self.temperature
|
||||||
model = self.model_name
|
model = self.model_name
|
||||||
max_output_tokens = self.max_output_tokens
|
max_tokens = self.max_tokens
|
||||||
top_k = self.top_k
|
|
||||||
top_p = self.top_p
|
top_p = self.top_p
|
||||||
n = self.n
|
n = self.n
|
||||||
|
|
||||||
|
|
@ -78,8 +69,7 @@ class PerplexityComponent(LCModelComponent):
|
||||||
model=model,
|
model=model,
|
||||||
temperature=temperature or 0.75,
|
temperature=temperature or 0.75,
|
||||||
pplx_api_key=api_key,
|
pplx_api_key=api_key,
|
||||||
top_k=top_k or None,
|
|
||||||
top_p=top_p or None,
|
top_p=top_p or None,
|
||||||
n=n or 1,
|
n=n or 1,
|
||||||
max_output_tokens=max_output_tokens,
|
max_tokens=max_tokens,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue