def llm_lib_installer_v1(imported_libs: str, python_version: str, task: str, api_key: str, libraries: str, model = 'openai/gpt-oss-20b'): ''' imported_libs: Give all the imports made in the current session of the notebook api_key: Generated groq api key task: The type of task being executed in the session notebook model: choose the groq model. Default is GPT OSS ''' from groq import Groq import streamlit as st client = Groq(api_key=api_key) completion = client.chat.completions.create( model=model, messages=[ { "role": "user", "content": f'''Assume we have imported a few libraries in the google colab environment: {imported_libs}. Generate a manual !pip install command for the imported libraries for the task: {task}. Take into account the current libraries: {libraries} Make sure there are no conflicts in the library versions even if the libraries are not imported. for instance opencv is dependent on the version of numpy. Suggest a version install for that as well even if it is not imported. In a similar way check all library dependencies. Try to take the latest libraries as far as possible. Suggest downgrades only if there is no other choice taking in consideration the python version in the environment is: {python_version}. Otherwise try and use the latest versions of the libraries. Use the "~=" symbol if needed to allow for backward compatibility between the installed libraries.''' } ], temperature=0, max_completion_tokens=8192, top_p=1, reasoning_effort="medium", stream=True, stop=None ) response_content = "" for chunk in completion: response_content+=chunk.choices[0].delta.content or "" return response_content