Skip to content

Commit

Permalink
Merge branch 'add_provider' of github.com:tmuife/dify into add_provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter-jin committed Aug 29, 2024
2 parents 7fcb3fd + af6ff13 commit 440bd20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions api/core/model_runtime/model_providers/oci/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _generate(self, model: str, credentials: dict,
if not valid_value:
raise InvokeBadRequestError("Does not support function calling")
if model.startswith("cohere"):
print("run cohere " * 10)
#print("run cohere " * 10)
for message in prompt_messages[:-1]:
text = ""
if isinstance(message.content, str):
Expand All @@ -285,7 +285,7 @@ def _generate(self, model: str, credentials: dict,
"chatHistory": chathistory, }
request_args["chatRequest"].update(args)
elif model.startswith("meta"):
print("run meta " * 10)
#print("run meta " * 10)
meta_messages = []
for message in prompt_messages:
text = message.content
Expand All @@ -298,10 +298,10 @@ def _generate(self, model: str, credentials: dict,

if stream:
request_args["chatRequest"]["isStream"] = True
print("final request" + "|" * 20)
print(request_args)
#print("final request" + "|" * 20)
#print(request_args)
response = client.chat(request_args)
print(vars(response))
#print(vars(response))

if stream:
return self._handle_generate_stream_response(model, credentials, response, prompt_messages)
Expand Down Expand Up @@ -356,7 +356,7 @@ def _handle_generate_stream_response(self, model: str, credentials: dict, respon
events = response.data.events()
for stream in events:
chunk = json.loads(stream.data)
print(chunk)
#print(chunk)
#chunk: {'apiFormat': 'COHERE', 'text': 'Hello'}


Expand Down
4 changes: 2 additions & 2 deletions api/core/model_runtime/model_providers/oci/oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ provider_credential_schema:
type: text-input
required: true
placeholder:
zh_Hans: 在此输入您的 oci api key 文件的内容(base64.b64encode("pem file content replace return".encode('utf-8')))
en_US: Enter your oci api key file's content(base64.b64encode("pem file content replace return".encode('utf-8')) )
zh_Hans: 在此输入您的 oci api key 文件的内容(base64.b64encode("pem file content".encode('utf-8')))
en_US: Enter your oci api key file's content(base64.b64encode("pem file content".encode('utf-8')) )

0 comments on commit 440bd20

Please sign in to comment.