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

Error SLF4J #5

Open
la-niina opened this issue Sep 17, 2023 · 0 comments
Open

Error SLF4J #5

la-niina opened this issue Sep 17, 2023 · 0 comments

Comments

@la-niina
Copy link

Description

I am not sure what the error details have no clue no idea but Have this error in my logs and there not response.

22:57:54.632 System.err         SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
22:57:54.632 System.err         SLF4J: Defaulting to no-operation (NOP) logger implementation
22:57:54.632 System.err         SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
22:57:55.041 TrafficStats       tagSocket(5) with statsTag=0xffffffff, statsUid=-1
22:57:56.772 System.out         Failed to  

Describe the issue briefly.
Hear is may code for reference since I have no idea what could be wrong what the error intells its the first time have encounter such and error and there isn't any relevant information on stackoverflaw

class RegenerativeModule(context: Context) {
    private val sharedPreferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
    private val appKey = sharedPreferences.getString("api_key", "")!!
    private var vertexAI: VertexAI = VertexAI.Builder()
        .setAccessToken(appKey)
        .setProjectId("metospherus-kit")
        .build()

    var textRequest = vertexAI.textRequest()
        .setModel("models/chat-bison-001")
        .setTemperature(0.8)
        .setMaxTokens(256)
        .setTopK(40)
        .setTopP(0.8)
}

Usage

  searchableInputEditText.setOnEditorActionListener { _, actionId, _ ->
                                if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE) {
                                    println("message input $query")
                                    CoroutineScope(Dispatchers.Main).launch {
                                        RegenerativeModule(requireContext()).textRequest
                                            .execute(query,object : VertexAI.Callback<Any> {
                                                override fun onError(throwable: Throwable) {
                                                    println("Failed to ${throwable.message} ${throwable.localizedMessage}")
                                                }

                                                override fun onSuccess(result: Any) {
                                                    val messageContent = result.toString()
                                                    println("context $messageContent")
                                                    CoroutineScope(Dispatchers.Main).launch {
                                                        if (messageContent != null) {
                                                            val words = messageContent.split("\\s+".toRegex())
                                                            val typingDelay = 100L

                                                            val messageComp = GeneralBrainResponse(
                                                                GeneralBrain.generateRandomId(),
                                                                query,
                                                                messageContent
                                                            )
                                                            Constructor.insertOrUpdateUserCompanionShip(
                                                                messageComp,
                                                                appDatabase
                                                            )

                                                            val responseText = StringBuilder()
                                                            for (word in words) {
                                                                searchRecyclerView.hideSkeleton()
                                                                responseText.append(
                                                                    "${
                                                                        word.replace(".", ".\n\n")
                                                                            .replace("?", "?\n\n")
                                                                            .replace("*", "\n\n*")
                                                                            .replace(".\n\n\n\n*", "\n\n*")
                                                                            .replace("\n*", "*")
                                                                            .replace(Regex("\\d\\."), "\n$0")
                                                                    } "
                                                                )
                                                                val repos = mutableListOf(
                                                                    GeneralSearchResults(
                                                                        "Metospherus - Comprehensive Medical System",
                                                                        responseText.toString().replace("\n\n ", "\n\n"),
                                                                    )
                                                                )
                                                                searchAdapter.setData(repos)
                                                                delay(typingDelay)
                                                            }
                                                        }
                                                    }
                                                }
                                            }).let {
                                        }
                                    }
                                }
                                true
                            }

Steps to Reproduce

  1. Build v1.1.0 as implementation in Kotlin not Kotlin Compose
  2. Follow the code implementation and run then input message and submit
  3. Nothing will happing in UI , but the logs will display that error

Environment

  • vertexai-kt version: 1.1.0
  • Kotlin version: jvmTarget = "17" Kotlin 1.8.10
  • OS: Development : Macos Monterey 12.6.9 , Testing : Device Android 13

Additional Info

Add any other relevant context here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant