Skip to content

Commit

Permalink
add: support for generate_content_async and start_chat
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Aug 6, 2024
1 parent 6aaf227 commit cf2f08a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions weave/integrations/gemini/gemini_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,24 @@ def wrapper(fn: Callable) -> Callable:
gemini_wrapper(name="google.generativeai.GenerativeModel.generate_content"),
),
SymbolPatcher(
lambda: importlib.import_module(
"google.generativeai.types.generation_types"
),
"GenerateContentResponse.from_response",
lambda: importlib.import_module("google.generativeai"),
"GenerativeModel.generate_content_async",
gemini_wrapper(
name="google.generativeai.types.generation_types.GenerateContentResponse.from_response"
name="google.generativeai.GenerativeModel.generate_content_async"
),
),
SymbolPatcher(
lambda: importlib.import_module("google.generativeai"),
"GenerativeModel.generate_content",
gemini_wrapper(name="google.generativeai.GenerativeModel.start_chat"),
),
SymbolPatcher(
lambda: importlib.import_module(
"google.generativeai.types.generation_types"
),
"GenerateContentResponse.from_iterator",
"GenerateContentResponse.from_response",
gemini_wrapper(
name="google.generativeai.types.generation_types.GenerateContentResponse.from_iterator"
name="google.generativeai.types.generation_types.GenerateContentResponse.from_response"
),
),
SymbolPatcher(
Expand Down

0 comments on commit cf2f08a

Please sign in to comment.