-
-
Save muyiwexy/963aeaf2545bb7c5f4fc2844287d6828 to your computer and use it in GitHub Desktop.
langchain_service_impl.dart(2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LangchainServicesImpl extends LangchainService { | |
final Connection connection; | |
final OpenAIEmbeddings embeddings; | |
final OpenAI openAI; | |
LangchainServicesImpl({ | |
required this.connection, | |
required this.embeddings, | |
required this.openAI, | |
}); | |
// do something | |
// do something | |
@override | |
Future<bool> checkExtExist() async { | |
final checkExtExist = await connection.execute( | |
"SELECT EXISTS (SELECT FROM pg_extension WHERE extname = 'vectors');", | |
); | |
return checkExtExist.first[0] as bool; | |
} | |
@override | |
Future<bool> checkTableExist(String tableName) async { | |
final checkTableExist = await connection.execute( | |
"SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'public' AND table_name = '$tableName');", | |
); | |
return checkTableExist.first[0] as bool; | |
} | |
} | |
void debugPrint(String message) { | |
if (kDebugMode) { | |
print(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment