Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DiscussService and TextService #512

Merged
merged 12 commits into from
Aug 22, 2024
10 changes: 0 additions & 10 deletions google/generativeai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@

from google.generativeai.client import configure

from google.generativeai.discuss import chat
from google.generativeai.discuss import chat_async
from google.generativeai.discuss import count_message_tokens

from google.generativeai.embedding import embed_content
from google.generativeai.embedding import embed_content_async

Expand All @@ -77,19 +73,13 @@
from google.generativeai.operations import list_operations
from google.generativeai.operations import get_operation

from google.generativeai.text import generate_text
from google.generativeai.text import generate_embeddings
from google.generativeai.text import count_text_tokens

from google.generativeai.types import GenerationConfig

__version__ = version.__version__

del discuss
del embedding
del files
del generative_models
del text
del models
del client
del operations
Expand Down
4 changes: 2 additions & 2 deletions google/generativeai/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def generate_answer(
answer_style: Style in which the grounded answer should be returned.
safety_settings: Safety settings for generated output. Defaults to None.
temperature: Controls the randomness of the output.
client: If you're not relying on a default client, you pass a `glm.TextServiceClient` instead.
client: If you're not relying on a default client, you pass a `glm.GenerativeServiceClient` instead.
request_options: Options for the request.

Returns:
Expand Down Expand Up @@ -337,7 +337,7 @@ async def generate_answer_async(
answer_style: Style in which the grounded answer should be returned.
safety_settings: Safety settings for generated output. Defaults to None.
temperature: Controls the randomness of the output.
client: If you're not relying on a default client, you pass a `glm.TextServiceClient` instead.
client: If you're not relying on a default client, you pass a `glm.GenerativeServiceClient` instead.

Returns:
A `types.Answer` containing the model's text answer response.
Expand Down
17 changes: 0 additions & 17 deletions google/generativeai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ async def create_file(self, *args, **kwargs):
class _ClientManager:
client_config: dict[str, Any] = dataclasses.field(default_factory=dict)
default_metadata: Sequence[tuple[str, str]] = ()

discuss_client: glm.DiscussServiceClient | None = None
shilpakancharla marked this conversation as resolved.
Show resolved Hide resolved
discuss_async_client: glm.DiscussServiceAsyncClient | None = None
clients: dict[str, Any] = dataclasses.field(default_factory=dict)

def configure(
Expand All @@ -119,7 +116,6 @@ def configure(
api_key: str | None = None,
credentials: ga_credentials.Credentials | dict | None = None,
# The user can pass a string to choose `rest` or `grpc` or 'grpc_asyncio'.
# See `_transport_registry` in `DiscussServiceClientMeta`.
MarkDaoust marked this conversation as resolved.
Show resolved Hide resolved
# Since the transport classes align with the client classes it wouldn't make
MarkDaoust marked this conversation as resolved.
Show resolved Hide resolved
# sense to accept a `Transport` object here even though the client classes can.
# We could accept a dict since all the `Transport` classes take the same args,
Expand Down Expand Up @@ -281,7 +277,6 @@ def configure(
api_key: str | None = None,
credentials: ga_credentials.Credentials | dict | None = None,
# The user can pass a string to choose `rest` or `grpc` or 'grpc_asyncio'.
# See `_transport_registry` in `DiscussServiceClientMeta`.
# Since the transport classes align with the client classes it wouldn't make
# sense to accept a `Transport` object here even though the client classes can.
# We could accept a dict since all the `Transport` classes take the same args,
Expand Down Expand Up @@ -326,14 +321,6 @@ def get_default_cache_client() -> glm.CacheServiceClient:
return _client_manager.get_default_client("cache")


def get_default_discuss_client() -> glm.DiscussServiceClient:
return _client_manager.get_default_client("discuss")


def get_default_discuss_async_client() -> glm.DiscussServiceAsyncClient:
return _client_manager.get_default_client("discuss_async")


def get_default_file_client() -> glm.FilesServiceClient:
return _client_manager.get_default_client("file")

Expand All @@ -350,10 +337,6 @@ def get_default_generative_async_client() -> glm.GenerativeServiceAsyncClient:
return _client_manager.get_default_client("generative_async")


def get_default_text_client() -> glm.TextServiceClient:
return _client_manager.get_default_client("text")


def get_default_operations_client() -> operations_v1.OperationsClient:
return _client_manager.get_default_client("operations")

Expand Down
Loading
Loading