Skip to content

Commit

Permalink
[#66] Remove deprecated constructs
Browse files Browse the repository at this point in the history
  • Loading branch information
uogbuji committed Mar 12, 2024
1 parent 37b41a7 commit 536143b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 47 deletions.
18 changes: 0 additions & 18 deletions pylib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,3 @@
# ruff: noqa: F401,F403

from .__about__ import __version__


def oapi_first_choice_text(response):
'''
Given an OpenAI-compatible API simple completion response, return the first choice text
'''
import warnings
warnings.warn(DeprecationWarning('Use the openai_api class\'s first_choice_text() method instead'))
return response['choices'][0]['text']


def oapi_chat_first_choice_message(response):
'''
Given an OpenAI-compatible API chat completion response, return the first choice message content
'''
import warnings
warnings.warn(DeprecationWarning('Use the openai_chat_api class\'s first_choice_message() method instead'))
return response['choices'][0]['message']['content']
8 changes: 0 additions & 8 deletions pylib/embedding/pgvector_data_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,6 @@ async def search(
Returns:
generator which yields the rows os the query results ass attributable dicts
'''
if query_tags is not None:
warnings.warn('query_tags is deprecated. Use tags instead.', DeprecationWarning)
tags = query_tags
# else:
# if not isinstance(query_tags, list):
# raise TypeError('query_tags must be a list of strings')
# if not all(isinstance(tag, str) for tag in query_tags):
# raise TypeError('query_tags must be a list of strings')
if threshold is not None:
if not isinstance(threshold, float):
raise TypeError('threshold must be a float')
Expand Down
13 changes: 0 additions & 13 deletions pylib/embedding/pgvector_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,6 @@ async def get_messages(
'metadata': record['metadata']
}) for record in message_records)

# async for record in message_records:
# yield attr_dict({
# 'ts': record['ts'],
# 'role': record['role'],
# 'content': record['content'],
# 'metadata': record['metadata']
# })

async def get_table(self, history_key):
# Deprecated
warnings.warn('pgvector_message.get_table() is deprecated. Use get_messages().', DeprecationWarning)
return list(await self.get_messages(history_key))

async def search(
self,
history_key: UUID,
Expand Down
8 changes: 0 additions & 8 deletions pylib/embedding/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,3 @@ def count(self):
current_count = int(str(self.db.count(self.name)).partition('=')[-1])
return current_count


# Already disambiguated by the module name. Anyone can use import as if that's not enough
# Deprecating the old name
class qdrant_collection(collection):
def __init__(self, name, embedding_model, db=None,
distance_function=None, **conn_params):
warnings.warn('qdrant_collection is deprecated. Use collection instead.', DeprecationWarning)
super().__init__(name, embedding_model, db=db, distance_function=distance_function, **conn_params)

0 comments on commit 536143b

Please sign in to comment.