Skip to content

Commit

Permalink
Allow api key to be set via model.key (#4)
Browse files Browse the repository at this point in the history
This makes the behavior consistent with the openai's one documented in https://llm.datasette.io/en/stable/python-api.html#basic-prompt-execution
  • Loading branch information
abulte authored Feb 26, 2024
1 parent 9acdce7 commit a4f6400
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llm_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def build_messages(self, prompt, conversation):
return messages

def execute(self, prompt, stream, response, conversation):
key = llm.get_key("", "mistral", "LLM_MISTRAL_KEY")
key = llm.get_key("", "mistral", "LLM_MISTRAL_KEY") or getattr(self, "key", None)
messages = self.build_messages(prompt, conversation)
response._prompt_json = {"messages": messages}
body = {
Expand Down

0 comments on commit a4f6400

Please sign in to comment.