feat: gemini pro function call (#3406)

This commit is contained in:
Yeuoly
2024-04-12 16:38:02 +08:00
committed by GitHub
parent 0737e930cb
commit a258a90291
4 changed files with 151 additions and 62 deletions

View File

@@ -10,6 +10,7 @@ from google.generativeai import GenerativeModel
from google.generativeai.client import _ClientManager, configure
from google.generativeai.types import GenerateContentResponse
from google.generativeai.types.generation_types import BaseGenerateContentResponse
from google.ai.generativelanguage_v1beta.types import content as gag_content
current_api_key = ''
@@ -29,7 +30,7 @@ class MockGoogleResponseClass(object):
}),
chunks=[]
)
)
else:
yield GenerateContentResponse(
done=False,
@@ -43,6 +44,14 @@ class MockGoogleResponseClass(object):
class MockGoogleResponseCandidateClass(object):
finish_reason = 'stop'
@property
def content(self) -> gag_content.Content:
return gag_content.Content(
parts=[
gag_content.Part(text='it\'s google!')
]
)
class MockGoogleClass(object):
@staticmethod
def generate_content_sync() -> GenerateContentResponse: