Skip to content

Commit

Permalink
fix(llm): fix together overwrite payload with kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
jqueguiner committed Oct 16, 2023
1 parent 9a841e9 commit f320a98
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libs/langchain/langchain/llms/together.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Together(LLM):
"repetition_penalty": 1
}
for api reference check together documentation:
for api reference check together documentation:
https://docs.together.ai/docs/inference-rest
"""

Expand Down Expand Up @@ -114,6 +114,17 @@ def _call(
"repetition_penalty": self.repetition_penalty,
}

# Overwrite the values in payload with kwargs if they are provided
for key in [
"temperature",
"top_p",
"top_k",
"max_tokens",
"repetition_penalty",
]:
if key in kwargs:
payload[key] = kwargs[key]

# filter None values to not pass them to the http payload
payload = {k: v for k, v in payload.items() if v is not None}

Expand Down

0 comments on commit f320a98

Please sign in to comment.