mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-17 16:41:05 +02:00
update code due to failed unittests
This commit is contained in:
parent
2eeb9556f5
commit
f2dbb51094
4 changed files with 14 additions and 6 deletions
|
|
@ -16,5 +16,5 @@ def LLM(llm_config: Optional[LLMConfig] = None, context: Context = None) -> Base
|
|||
"""get the default llm provider if name is None"""
|
||||
ctx = context or Context()
|
||||
if llm_config is not None:
|
||||
ctx.llm_with_cost_manager_from_llm_config(llm_config)
|
||||
return ctx.llm_with_cost_manager_from_llm_config(llm_config)
|
||||
return ctx.llm()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Desc : Google Gemini LLM from https://ai.google.dev/tutorials/python_quickstart
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
import google.generativeai as genai
|
||||
from google.ai import generativelanguage as glm
|
||||
from google.generativeai.generative_models import GenerativeModel
|
||||
|
|
@ -58,7 +60,7 @@ class GeminiLLM(BaseLLM):
|
|||
def __init_gemini(self, config: LLMConfig):
|
||||
genai.configure(api_key=config.api_key)
|
||||
|
||||
def _user_msg(self, msg: str) -> dict[str, str]:
|
||||
def _user_msg(self, msg: str, images: Optional[Union[str, list[str]]] = None) -> dict[str, str]:
|
||||
# Not to change BaseLLM default functions but update with Gemini's conversation format.
|
||||
# You should follow the format.
|
||||
return {"role": "user", "parts": [msg]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue