_call() — langchain Function Reference
Architecture documentation for the _call() function in llms.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 26ae2aaf_8fa1_b5b1_7053_5c4fcf4abcbf["_call()"] 4dfba76d_967f_bdbe_e65a_3ddf00dc8892["Fireworks"] 26ae2aaf_8fa1_b5b1_7053_5c4fcf4abcbf -->|defined in| 4dfba76d_967f_bdbe_e65a_3ddf00dc8892 8d4f4229_b5de_0a63_174b_10061594c160["_format_output()"] 26ae2aaf_8fa1_b5b1_7053_5c4fcf4abcbf -->|calls| 8d4f4229_b5de_0a63_174b_10061594c160 style 26ae2aaf_8fa1_b5b1_7053_5c4fcf4abcbf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/fireworks/langchain_fireworks/llms.py lines 124–175
def _call(
self,
prompt: str,
stop: list[str] | None = None,
run_manager: CallbackManagerForLLMRun | None = None,
**kwargs: Any,
) -> str:
"""Call out to Fireworks's text generation endpoint.
Args:
prompt: The prompt to pass into the model.
stop: Optional list of stop sequences to use.
run_manager: (Not used) Optional callback manager for LLM run.
kwargs: Additional parameters to pass to the model.
Returns:
The string generated by the model.
"""
headers = {
"Authorization": f"Bearer {self.fireworks_api_key.get_secret_value()}",
"Content-Type": "application/json",
}
stop_to_use = stop[0] if stop and len(stop) == 1 else stop
payload: dict[str, Any] = {
**self.default_params,
"prompt": prompt,
"stop": stop_to_use,
**kwargs,
}
# filter None values to not pass them to the http payload
payload = {k: v for k, v in payload.items() if v is not None}
response = requests.post(
url=self.base_url, json=payload, headers=headers, timeout=self.timeout
)
if response.status_code >= 500:
msg = f"Fireworks Server: Error {response.status_code}"
raise Exception(msg)
if response.status_code >= 400:
msg = f"Fireworks received an invalid payload: {response.text}"
raise ValueError(msg)
if response.status_code != 200:
msg = (
f"Fireworks returned an unexpected response with status "
f"{response.status_code}: {response.text}"
)
raise Exception(msg)
data = response.json()
return self._format_output(data)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does _call() do?
_call() is a function in the langchain codebase, defined in libs/partners/fireworks/langchain_fireworks/llms.py.
Where is _call() defined?
_call() is defined in libs/partners/fireworks/langchain_fireworks/llms.py at line 124.
What does _call() call?
_call() calls 1 function(s): _format_output.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free