Improvement/add getting api key from env (#1710)

This commit is contained in:
dbcontributions
2024-08-19 22:35:28 +05:30
committed by GitHub
parent 8476ce5d8e
commit 0e0d0b8fc7
3 changed files with 12 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import os
import json
from typing import Dict, List, Optional
@@ -20,6 +21,9 @@ class TogetherLLM(LLMBase):
self.config.model = "mistralai/Mixtral-8x7B-Instruct-v0.1"
self.client = Together()
api_key = os.getenv("TOGETHER_API_KEY") or self.config.api_key
self.client = Together(api_key=api_key)
def _parse_response(self, response, tools):
"""
Process the response based on whether tools are used or not.