MCPcopy Index your code
hub / github.com/CopilotKit/OpenGenerativeUI / build_model

Function build_model

apps/agent/src/model.py:17–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def build_model() -> BaseChatModel:
18 model_name = os.environ.get("LLM_MODEL", DEFAULT_MODEL)
19 if model_name.startswith("gpt-"):
20 # Production fallback: gpt-* names route to OpenAI so LLM_MODEL can be
21 # flipped in the deploy dashboard without a code change. No max_tokens
22 # override here — OpenAI's default matches pre-migration behavior.
23 from langchain_openai import ChatOpenAI
24
25 return ChatOpenAI(model=model_name)
26 return ChatAnthropic(
27 model=model_name,
28 max_tokens=MAX_TOKENS,
29 )

Calls

no outgoing calls