Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion langchain/llms/textgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class TextGen(LLM):
model_url: str
"""The full URL to the textgen webui including http[s]://host:port """

preset: Optional[str] = None
"""The preset to use in the textgen webui """

max_new_tokens: Optional[int] = 250
"""The maximum number of tokens to generate."""

Expand Down Expand Up @@ -162,7 +165,10 @@ def _get_parameters(self, stop: Optional[List[str]] = None) -> Dict[str, Any]:
if self.stopping_strings and stop is not None:
raise ValueError("`stop` found in both the input and default params.")

params = self._default_params
if self.preset is None:
params = self._default_params
else:
params = {"preset": self.preset}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this still use self._default params?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will use the preset defined in textgen, no need for additional params. all this params are defined in the preset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hwchase17 is all the checks must pass? when it will be merged?


# then sets it as configured, or default to an empty list:
params["stop"] = self.stopping_strings or stop or []
Expand Down