mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-04 13:48:31 +00:00
Compare commits
15 Commits
devin/1750
...
devin/1750
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1de749d192 | ||
|
|
6a171190f9 | ||
|
|
911e02da8e | ||
|
|
eddeacebcc | ||
|
|
5b5b462238 | ||
|
|
3af61f428d | ||
|
|
a3416f4301 | ||
|
|
b58f375b54 | ||
|
|
12342ce41c | ||
|
|
babcd1d712 | ||
|
|
cabdfafb4a | ||
|
|
dc25c32ca0 | ||
|
|
bc4fd6a39b | ||
|
|
842311a52b | ||
|
|
e7872f02c4 |
@@ -684,28 +684,6 @@ In this section, you'll find detailed examples that help you select, configure,
|
||||
- openrouter/deepseek/deepseek-chat
|
||||
</Info>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Nebius AI Studio">
|
||||
Set the following environment variables in your `.env` file:
|
||||
```toml Code
|
||||
NEBIUS_API_KEY=<your-api-key>
|
||||
```
|
||||
|
||||
Example usage in your CrewAI project:
|
||||
```python Code
|
||||
llm = LLM(
|
||||
model="nebius/Qwen/Qwen3-30B-A3B"
|
||||
)
|
||||
```
|
||||
|
||||
<Info>
|
||||
Nebius AI Studio features:
|
||||
- Large collection of open source models
|
||||
- Higher rate limits
|
||||
- Competitive pricing
|
||||
- Good balance of speed and quality
|
||||
</Info>
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Streaming Responses
|
||||
|
||||
@@ -34,7 +34,6 @@ LiteLLM supports a wide range of providers, including but not limited to:
|
||||
- DeepInfra
|
||||
- Groq
|
||||
- SambaNova
|
||||
- Nebius AI Studio
|
||||
- [NVIDIA NIMs](https://docs.api.nvidia.com/nim/reference/models-1)
|
||||
- And many more!
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class PydanticSchemaParser(BaseModel):
|
||||
key_type, value_type = get_args(field_type)
|
||||
return f"Dict[{key_type.__name__}, {value_type.__name__}]"
|
||||
|
||||
if origin is Union or (origin is None and len(get_args(field_type)) > 0):
|
||||
if origin is Union:
|
||||
return self._format_union_type(field_type, depth)
|
||||
|
||||
if isinstance(field_type, type) and issubclass(field_type, BaseModel):
|
||||
@@ -42,10 +42,7 @@ class PydanticSchemaParser(BaseModel):
|
||||
nested_indent = " " * 4 * depth
|
||||
return f"{field_type.__name__}\n{nested_indent}{{\n{nested_schema}\n{nested_indent}}}"
|
||||
|
||||
if hasattr(field_type, '__name__'):
|
||||
return field_type.__name__
|
||||
else:
|
||||
return str(field_type)
|
||||
return field_type.__name__
|
||||
|
||||
def _format_list_type(self, list_item_type, depth: int) -> str:
|
||||
if isinstance(list_item_type, type) and issubclass(list_item_type, BaseModel):
|
||||
@@ -86,13 +83,10 @@ class PydanticSchemaParser(BaseModel):
|
||||
if origin in {dict, Dict}:
|
||||
key_type, value_type = get_args(annotation)
|
||||
return f"Dict[{key_type.__name__}, {value_type.__name__}]"
|
||||
if origin is Union or (origin is None and len(get_args(annotation)) > 0):
|
||||
if origin is Union:
|
||||
return self._format_union_type(annotation, depth)
|
||||
if isinstance(annotation, type) and issubclass(annotation, BaseModel):
|
||||
nested_schema = self._get_model_schema(annotation, depth)
|
||||
nested_indent = " " * 4 * depth
|
||||
return f"{annotation.__name__}\n{nested_indent}{{\n{nested_schema}\n{nested_indent}}}"
|
||||
if hasattr(annotation, '__name__'):
|
||||
return annotation.__name__
|
||||
else:
|
||||
return str(annotation)
|
||||
return annotation.__name__
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
import pytest
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from crewai.utilities.pydantic_schema_parser import PydanticSchemaParser
|
||||
|
||||
@@ -91,39 +92,3 @@ def test_model_with_dict():
|
||||
dict_field: Dict[str, int]
|
||||
}"""
|
||||
assert schema.strip() == expected_schema.strip()
|
||||
|
||||
|
||||
def test_model_with_python310_union_syntax():
|
||||
class UnionTypeModel(BaseModel):
|
||||
union_field: str | None
|
||||
multi_union_field: int | str | None
|
||||
non_optional_union: int | str
|
||||
|
||||
parser = PydanticSchemaParser(model=UnionTypeModel)
|
||||
schema = parser.get_schema()
|
||||
|
||||
expected_schema = """{
|
||||
union_field: str | None,
|
||||
multi_union_field: int | str | None,
|
||||
non_optional_union: int | str
|
||||
}"""
|
||||
assert schema.strip() == expected_schema.strip()
|
||||
|
||||
|
||||
def test_mixed_union_syntax():
|
||||
class MixedUnionModel(BaseModel):
|
||||
traditional_optional: Optional[str]
|
||||
new_union_syntax: str | None
|
||||
traditional_union: Union[int, str]
|
||||
new_multi_union: int | str | float
|
||||
|
||||
parser = PydanticSchemaParser(model=MixedUnionModel)
|
||||
schema = parser.get_schema()
|
||||
|
||||
expected_schema = """{
|
||||
traditional_optional: Optional[str],
|
||||
new_union_syntax: str | None,
|
||||
traditional_union: Union[int, str],
|
||||
new_multi_union: int | str | float
|
||||
}"""
|
||||
assert schema.strip() == expected_schema.strip()
|
||||
|
||||
Reference in New Issue
Block a user