MindSearch icon indicating copy to clipboard operation
MindSearch copied to clipboard

Enhancement: Using Groq

Open bakongi opened this issue 1 year ago • 3 comments

Hi everyone:

To use Groq, just add in models.py:

url = 'https://api.groq.com/openai/v1/chat/completions'
groq = dict(type=GPTAPI,
            model_type='gemma2-9b-it',
            key=os.environ.get('GROQ_API_KEY', 'YOUR GROQ API KEY'),
            openai_api_base=url,
            temperature=0,
            max_new_tokens=4096,
            repetition_penalty=1.02
            )

bakongi avatar Aug 03 '24 08:08 bakongi

I tried this, for me it threw an error (because of GPTAPI). It was: NotImplementedError(f'Model type {model_type} is not supported')

For a quick fix, I changed the following code in openai.py file (from where this error is occurring) - From if model_type.lower().startswith('gpt'): to if model_type.lower().startswith('gpt') or model_type.lower().startswith('llama'):

I am using llama-3.1-8b-versatile.

snehpushp avatar Aug 08 '24 20:08 snehpushp

I tried this, for me it threw an error (because of GPTAPI). It was: NotImplementedError(f'Model type {model_type} is not supported')

For a quick fix, I changed the following code in openai.py file (from where this error is occurring) - From if model_type.lower().startswith('gpt'): to if model_type.lower().startswith('gpt') or model_type.lower().startswith('llama'):

I am using llama-3.1-8b-versatile.

You should modify lagent\llms\openai.py file in lagent package:

['gpt', 'gemma', 'llama', 'mixtral']

        # Model-specific processing
        data = {}
        if any(model_type.lower().startswith(prefix) for prefix in ['gpt', 'gemma', 'llama', 'mixtral']):
            if 'top_k' in gen_params:

bakongi avatar Aug 09 '24 09:08 bakongi

@bakongi

when use groq with above changes I have below error:

ERROR:root:Exception in sync_generator_wrapper: 'detail' Traceback (most recent call last): File "/home/bc/Projects/ODS/MindSearch/mindsearch/app.py", line 69, in sync_generator_wrapper for response in agent.stream_chat(inputs): File "/home/bc/Projects/ODS/MindSearch/mindsearch/agent/mindsearch_agent.py", line 237, in stream_chat yield from self._process_code(agent_return, inner_history, File "/home/bc/Projects/ODS/MindSearch/mindsearch/agent/mindsearch_agent.py", line 284, in _process_code reference, references_url = self._generate_reference( File "/home/bc/Projects/ODS/MindSearch/mindsearch/agent/mindsearch_agent.py", line 316, in _generate_reference actions = agent_return.nodes[node_name]['detail'].actions KeyError: 'detail'

MyraBaba avatar Aug 10 '24 15:08 MyraBaba