Client reference
foodapi.client.FoodAPI ¶ FoodAPI( *, api_key: str | None = None, base_url: str = DEFAULT_BASE_URL, timeout: float = 60.0, max_retries: int = 3, user_agent: str…
PythonTypeScript
foodapi.client.FoodAPI
¶
FoodAPI(
*,
api_key: str | None = None,
base_url: str = DEFAULT_BASE_URL,
timeout: float = 60.0,
max_retries: int = 3,
user_agent: str | None = None,
debug: bool = False,
external_user_id: str | None = None
)
Bases: ClientDiagnosticsMixin
Official synchronous FoodAPI SDK client.
Example::
client = FoodAPI(api_key="foodapi_xxx")
result = client.reason(recipe_id="...", goal="RECOMMENDATION")
print(result.confidence_score)
resources
instance-attribute
¶
resources = ClientResources(
reasoning=reasoning,
recipes=recipes,
ingredients=ingredients,
pantry=pantry,
shopping=shopping,
dietary=dietary,
kitchen=kitchen,
decisions=decisions,
developers=developers,
health=health,
recipe_exports=recipe_exports,
recipe_redistribution_feeds=recipe_redistribution_feeds,
derived_artifacts=derived_artifacts,
billing=billing,
)
reason
¶
reason(
*,
recipe_id: str | UUID,
goal: str | ReasonGoal = RECOMMENDATION,
pantry_item_ids: Sequence[str | UUID] | None = None,
dietary_preferences: (
Sequence[str | DietaryPreference] | None
) = None,
max_missing_ingredients: int = 3,
allow_substitutions: bool = True,
include_trace: bool = False,
external_user_id: str | None = None
) -> ReasonResponse
Convenience wrapper for client.reasoning.reason().
Related
- AsyncFoodAPI
- Resources overview —
client.resourcesnamespace