Spaces:
Runtime error
Runtime error
Download core/llm.py from raystermomo/LineChatbot: direct link, hf CLI and curl.
- Browser
- Download file 361 Bytes
-
https://huggingface.co/spaces/raystermomo/LineChatbot/resolve/main/core/llm.py
- Command line
-
hf download hf://spaces/raystermomo/LineChatbot/core/llm.py
-
curl -L -o llm.py https://huggingface.co/spaces/raystermomo/LineChatbot/resolve/main/core/llm.py
361 Bytes
| ''' | |
| API呼び出し | |
| ''' | |
| # core/llm.py | |
| from openai import OpenAI | |
| client = OpenAI() | |
| def call_openai(system_prompt: str, context_prompt: str) -> str: | |
| response = client.responses.create( | |
| model="gpt-4.1-mini", | |
| instructions=system_prompt, | |
| input=context_prompt, | |
| max_output_tokens=100, | |
| ) | |
| return response.output_text.strip() |