peterpeter8585 commited on
Commit
9337589
·
verified ·
1 Parent(s): 2005ffc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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(BaseChatModel):
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 _generate(self, messages: List[Any], stop: Optional[List[str]] = None, **kwargs):
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 _agenerate(self, messages: List[Any], stop: Optional[List[str]] = None, **kwargs):
77
- return self._generate(messages, stop, **kwargs)
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