Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cyyeh committed Dec 6, 2024
1 parent cc63632 commit d72e400
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 7 additions & 6 deletions wren-ai-service/src/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ def llm_processor(entry: dict) -> dict:
returned = {}
for model in entry.get("models", []):
model_name = f"{entry.get('provider')}.{model.get('model')}"
model_additional_params = {
k: v for k, v in model.items() if k not in ["model", "kwargs"]
}
returned[model_name] = {
"provider": entry.get("provider"),
"model": model.get("model"),
"kwargs": model.get("kwargs"),
"api_base": model.get("api_base"),
"api_version": model.get("api_version"),
"api_key_name": model.get("api_key_name"),
"provider": entry["provider"],
"model": model["model"],
"kwargs": model["kwargs"],
**model_additional_params,
**others,
}
return returned
Expand Down
5 changes: 4 additions & 1 deletion wren-ai-service/src/providers/llm/litellm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os
from typing import Any, Callable, Dict, List, Optional, Union

from haystack.components.generators.openai_utils import (
_convert_message_to_openai_format,
)
from haystack.dataclasses import ChatMessage, StreamingChunk
from litellm import acompletion
from litellm.types.utils import ModelResponse
Expand Down Expand Up @@ -56,7 +59,7 @@ async def _run(
messages = [message]

openai_formatted_messages = [
message.to_openai_format() for message in messages
_convert_message_to_openai_format(message) for message in messages
]

generation_kwargs = {
Expand Down

0 comments on commit d72e400

Please sign in to comment.