Skip to content

Commit 7342a62

Browse files
Remove DiscussService and TextService (#512)
* Remove DiscussService and TextService * Remove references to TextService in answer.py, remove refs in client.py * Remove reference from test case for client * Modify text_types.py for embeddings * Delete certain markdown files, update other mds * Delete generate emb md * Fix tests * Revert "Delete generate emb md" This reverts commit d4177f7. * Revert "Delete certain markdown files, update other mds" This reverts commit dca0b1f. * Reformat * Added other clients to test_client parameters * Update google/generativeai/client.py --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent 526fe03 commit 7342a62

File tree

13 files changed

+23
-2257
lines changed

13 files changed

+23
-2257
lines changed

google/generativeai/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848

4949
from google.generativeai.client import configure
5050

51-
from google.generativeai.discuss import chat
52-
from google.generativeai.discuss import chat_async
53-
from google.generativeai.discuss import count_message_tokens
54-
5551
from google.generativeai.embedding import embed_content
5652
from google.generativeai.embedding import embed_content_async
5753

@@ -77,19 +73,13 @@
7773
from google.generativeai.operations import list_operations
7874
from google.generativeai.operations import get_operation
7975

80-
from google.generativeai.text import generate_text
81-
from google.generativeai.text import generate_embeddings
82-
from google.generativeai.text import count_text_tokens
83-
8476
from google.generativeai.types import GenerationConfig
8577

8678
__version__ = version.__version__
8779

88-
del discuss
8980
del embedding
9081
del files
9182
del generative_models
92-
del text
9383
del models
9484
del client
9585
del operations

google/generativeai/answer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def generate_answer(
283283
answer_style: Style in which the grounded answer should be returned.
284284
safety_settings: Safety settings for generated output. Defaults to None.
285285
temperature: Controls the randomness of the output.
286-
client: If you're not relying on a default client, you pass a `glm.TextServiceClient` instead.
286+
client: If you're not relying on a default client, you pass a `glm.GenerativeServiceClient` instead.
287287
request_options: Options for the request.
288288
289289
Returns:
@@ -337,7 +337,7 @@ async def generate_answer_async(
337337
answer_style: Style in which the grounded answer should be returned.
338338
safety_settings: Safety settings for generated output. Defaults to None.
339339
temperature: Controls the randomness of the output.
340-
client: If you're not relying on a default client, you pass a `glm.TextServiceClient` instead.
340+
client: If you're not relying on a default client, you pass a `glm.GenerativeServiceClient` instead.
341341
342342
Returns:
343343
A `types.Answer` containing the model's text answer response.

google/generativeai/client.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ async def create_file(self, *args, **kwargs):
108108
class _ClientManager:
109109
client_config: dict[str, Any] = dataclasses.field(default_factory=dict)
110110
default_metadata: Sequence[tuple[str, str]] = ()
111-
112-
discuss_client: glm.DiscussServiceClient | None = None
113-
discuss_async_client: glm.DiscussServiceAsyncClient | None = None
114111
clients: dict[str, Any] = dataclasses.field(default_factory=dict)
115112

116113
def configure(
@@ -119,7 +116,7 @@ def configure(
119116
api_key: str | None = None,
120117
credentials: ga_credentials.Credentials | dict | None = None,
121118
# The user can pass a string to choose `rest` or `grpc` or 'grpc_asyncio'.
122-
# See `_transport_registry` in `DiscussServiceClientMeta`.
119+
# See _transport_registry in the google.ai.generativelanguage package.
123120
# Since the transport classes align with the client classes it wouldn't make
124121
# sense to accept a `Transport` object here even though the client classes can.
125122
# We could accept a dict since all the `Transport` classes take the same args,
@@ -281,7 +278,6 @@ def configure(
281278
api_key: str | None = None,
282279
credentials: ga_credentials.Credentials | dict | None = None,
283280
# The user can pass a string to choose `rest` or `grpc` or 'grpc_asyncio'.
284-
# See `_transport_registry` in `DiscussServiceClientMeta`.
285281
# Since the transport classes align with the client classes it wouldn't make
286282
# sense to accept a `Transport` object here even though the client classes can.
287283
# We could accept a dict since all the `Transport` classes take the same args,
@@ -326,14 +322,6 @@ def get_default_cache_client() -> glm.CacheServiceClient:
326322
return _client_manager.get_default_client("cache")
327323

328324

329-
def get_default_discuss_client() -> glm.DiscussServiceClient:
330-
return _client_manager.get_default_client("discuss")
331-
332-
333-
def get_default_discuss_async_client() -> glm.DiscussServiceAsyncClient:
334-
return _client_manager.get_default_client("discuss_async")
335-
336-
337325
def get_default_file_client() -> glm.FilesServiceClient:
338326
return _client_manager.get_default_client("file")
339327

@@ -350,10 +338,6 @@ def get_default_generative_async_client() -> glm.GenerativeServiceAsyncClient:
350338
return _client_manager.get_default_client("generative_async")
351339

352340

353-
def get_default_text_client() -> glm.TextServiceClient:
354-
return _client_manager.get_default_client("text")
355-
356-
357341
def get_default_operations_client() -> operations_v1.OperationsClient:
358342
return _client_manager.get_default_client("operations")
359343

0 commit comments

Comments
 (0)