Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
h0rv committed May 4, 2024
1 parent 493635d commit cc3bf37
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions llm_watsonx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import List, Literal, Optional, Union, get_args, get_origin, Dict, Any
from typing import Any, Dict, List, Literal, Optional, Union, get_args, get_origin

import llm
from ibm_watsonx_ai.foundation_models import Embeddings, ModelInference, get_model_specs
Expand Down Expand Up @@ -27,9 +27,11 @@ def get_env():

return (api_key, project_id)


def add_model_name_prefix(model):
return watsonx_model_name_prefix + model


def strip_model_name_prefix(model):
return model.lstrip(watsonx_model_name_prefix)

Expand Down Expand Up @@ -182,7 +184,11 @@ def execute(self, prompt, stream, response, conversation):
if prompt.system:
prompt.prompt = prompt.system + "\n\n" + prompt.prompt

text = prompt.prompt if not conversation else self.build_chat_prompt(prompt, conversation)
text = (
prompt.prompt
if not conversation
else self.build_chat_prompt(prompt, conversation)
)

params = prompt.options.to_payload()

Expand Down

0 comments on commit cc3bf37

Please sign in to comment.