Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ from requests.adapters import HTTPAdapter, Retry
|
|
| 20 |
from typing import List, Optional, Dict, Any
|
| 21 |
|
| 22 |
|
| 23 |
-
class GitHubModelLLM(
|
| 24 |
"""GitHub Models API를 사용하는 ChatOpenAI 대체 클래스"""
|
| 25 |
|
| 26 |
model_name: str = "openai/gpt-4.1"
|
|
@@ -48,7 +48,7 @@ class GitHubModelLLM(BaseChatModel):
|
|
| 48 |
resp.raise_for_status()
|
| 49 |
return resp.json()
|
| 50 |
|
| 51 |
-
def
|
| 52 |
"""ConversationBufferMemory의 이전 대화까지 포함해 메시지 생성"""
|
| 53 |
msg_list = []
|
| 54 |
|
|
@@ -73,8 +73,8 @@ class GitHubModelLLM(BaseChatModel):
|
|
| 73 |
content = res.get("choices", [{}])[0].get("message", {}).get("content", "")
|
| 74 |
return content
|
| 75 |
|
| 76 |
-
async def
|
| 77 |
-
return self.
|
| 78 |
from typing import Optional, List, Dict, Any
|
| 79 |
from langchain.llms.base import LLM
|
| 80 |
import requests, os, json
|
|
|
|
| 20 |
from typing import List, Optional, Dict, Any
|
| 21 |
|
| 22 |
|
| 23 |
+
class GitHubModelLLM(LLM):
|
| 24 |
"""GitHub Models API를 사용하는 ChatOpenAI 대체 클래스"""
|
| 25 |
|
| 26 |
model_name: str = "openai/gpt-4.1"
|
|
|
|
| 48 |
resp.raise_for_status()
|
| 49 |
return resp.json()
|
| 50 |
|
| 51 |
+
def _call(self, messages: List[Any], stop: Optional[List[str]] = None, **kwargs):
|
| 52 |
"""ConversationBufferMemory의 이전 대화까지 포함해 메시지 생성"""
|
| 53 |
msg_list = []
|
| 54 |
|
|
|
|
| 73 |
content = res.get("choices", [{}])[0].get("message", {}).get("content", "")
|
| 74 |
return content
|
| 75 |
|
| 76 |
+
async def _acall(self, messages: List[Any], stop: Optional[List[str]] = None, **kwargs):
|
| 77 |
+
return self._call(messages, stop, **kwargs)
|
| 78 |
from typing import Optional, List, Dict, Any
|
| 79 |
from langchain.llms.base import LLM
|
| 80 |
import requests, os, json
|