Transformers documentation
tiny-agents
시작하기
기본 클래스
모델
Preprocessors
추론
학습
하드웨어
양자화
생태계 통합
리소스
API
You are viewing v5.24.0 version. A newer version v5.24.1 is available.
tiny-agents
tiny-agents는 도구를 사용하는 에이전트를 구축하기 위한 최소한의 패턴을 제공합니다. 작은 Python 루프가 MCP 클라이언트를 MCP 서버의 도구와 연결합니다. Hugging Face Spaces는 MCP 서버로 작동합니다. Hub에서 더 많은 호환되는 Spaces를 찾아보세요.
로컬 모델과 도구 서버를 가리키는 설정 파일을 생성합니다. 이 예시에서는 이미지 생성 Space를 사용합니다.
{
"model": "Menlo/Jan-nano",
"endpointUrl": "http://localhost:8000",
"servers": [
{
"type": "sse",
"url": "https://evalstate-flux1-schnell.hf.space/gradio_api/mcp/sse"
}
]
}config를 사용하여 에이전트를 실행합니다.
tiny-agents run path/to/your/config.json
transformers serve가 백그라운드에서 실행 중인지 확인하세요. 에이전트는 로컬 모델을 사용하여 이미지 생성 도구를 실행합니다.
Agent loaded with 1 tools:
• flux1_schnell_infer
» Generate an image of a cat on the moon
<Tool req_0_tool_call>flux1_schnell_infer {"prompt": "a cat on the moon", "seed": 42, "randomize_seed": true, "width": 1024, "height": 1024, "num_inference_steps": 4}
Tool req_0_tool_call
[Binary Content: Image image/webp, 57732 bytes]
The task is complete and the content accessible to the User
Image URL: https://evalstate-flux1-schnell.hf.space/gradio_api/file=/tmp/gradio/3dbddc0e53b5a865ed56a4e3dbdd30f3f61cf3b8aabf1b456f43e5241bd968b8/image.webp
380576952
I have generated an image of a cat on the moon using the Flux 1 Schnell Image Generator. The image is 1024x1024 pixels and was created with 4 inference steps. Let me know if you would like to make any changes or need further assistance!