ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from tau_bench.model_utils.api.datapoint import Datapoint
|
||||
from tau_bench.model_utils.model.vllm_completion import VLLMCompletionModel
|
||||
from tau_bench.model_utils.model.vllm_utils import generate_request
|
||||
|
||||
|
||||
class OutlinesCompletionModel(VLLMCompletionModel):
|
||||
def parse_force_from_prompt(
|
||||
self, prompt: str, typ: BaseModel, temperature: float | None = None
|
||||
) -> dict[str, Any]:
|
||||
if temperature is None:
|
||||
temperature = self.temperature
|
||||
schema = typ.model_json_schema()
|
||||
res = generate_request(
|
||||
url=self.url,
|
||||
prompt=prompt,
|
||||
force_json=True,
|
||||
schema=schema,
|
||||
temperature=temperature,
|
||||
)
|
||||
return self.handle_parse_force_response(prompt=prompt, content=res)
|
||||
|
||||
def get_approx_cost(self, dp: Datapoint) -> float:
|
||||
return super().get_approx_cost(dp)
|
||||
|
||||
def get_latency(self, dp: Datapoint) -> float:
|
||||
return super().get_latency(dp)
|
||||
|
||||
def get_capability(self) -> float:
|
||||
return super().get_capability()
|
||||
|
||||
def supports_dp(self, dp: Datapoint) -> bool:
|
||||
return super().supports_dp(dp)
|
||||
Reference in New Issue
Block a user