repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/__init__.py | llama-index-core/llama_index/core/agent/__init__.py | # workflow agents + utils
from llama_index.core.agent.workflow.function_agent import FunctionAgent
from llama_index.core.agent.workflow.multi_agent_workflow import AgentWorkflow
from llama_index.core.agent.workflow.base_agent import BaseWorkflowAgent
from llama_index.core.agent.workflow.codeact_agent import CodeActAgen... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/prompts.py | llama-index-core/llama_index/core/agent/workflow/prompts.py | DEFAULT_HANDOFF_PROMPT = """Useful for handing off to another agent.
If you are currently not equipped to handle the user's request, or another agent is better suited to handle the request, please hand off to the appropriate agent.
Currently available agents:
{agent_info}
"""
DEFAULT_STATE_PROMPT = """Current state:
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/react_agent.py | llama-index-core/llama_index/core/agent/workflow/react_agent.py | import uuid
from typing import List, Sequence, Optional, cast
from llama_index.core.agent.react.formatter import ReActChatFormatter
from llama_index.core.agent.react.output_parser import ReActOutputParser
from llama_index.core.agent.react.types import (
ActionReasoningStep,
BaseReasoningStep,
ObservationRe... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py | llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py | from abc import ABCMeta
import inspect
import warnings
from typing import Any, Callable, Dict, List, Optional, Sequence, Union, Type, cast
from pydantic import BaseModel
from llama_index.core.agent.utils import generate_structured_response
from llama_index.core.agent.workflow.base_agent import (
BaseWorkflowAgent,... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/base_agent.py | llama-index-core/llama_index/core/agent/workflow/base_agent.py | from abc import abstractmethod
import functools
import warnings
import inspect
from typing import Any, Callable, Dict, List, Sequence, Optional, Union, Type, cast
from pydantic._internal._model_construction import ModelMetaclass
from llama_index.core.agent.workflow.prompts import DEFAULT_STATE_PROMPT
from llama_index.... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/__init__.py | llama-index-core/llama_index/core/agent/workflow/__init__.py | from llama_index.core.agent.workflow.multi_agent_workflow import AgentWorkflow
from llama_index.core.agent.workflow.base_agent import BaseWorkflowAgent
from llama_index.core.agent.workflow.codeact_agent import CodeActAgent
from llama_index.core.agent.workflow.function_agent import FunctionAgent
from llama_index.core.ag... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/codeact_agent.py | llama-index-core/llama_index/core/agent/workflow/codeact_agent.py | import inspect
import re
import uuid
from typing import Awaitable, Callable, List, Sequence, Union, Optional, Tuple
from llama_index.core.agent.workflow.base_agent import BaseWorkflowAgent
from llama_index.core.agent.workflow.workflow_events import (
AgentInput,
AgentOutput,
AgentStream,
ToolCallResult... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/function_agent.py | llama-index-core/llama_index/core/agent/workflow/function_agent.py | from typing import List, Optional, Sequence
from llama_index.core.agent.workflow.base_agent import BaseWorkflowAgent
from llama_index.core.agent.workflow.workflow_events import (
AgentInput,
AgentOutput,
AgentStream,
ToolCallResult,
)
from llama_index.core.base.llms.types import ChatResponse
from llama... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/workflow/workflow_events.py | llama-index-core/llama_index/core/agent/workflow/workflow_events.py | import logging
import warnings
import json
from typing import Any, Optional, Dict, Type
from llama_index.core.bridge.pydantic import (
Field,
model_serializer,
ValidationError,
BaseModel,
)
from llama_index.core.tools import ToolSelection, ToolOutput
from llama_index.core.llms import ChatMessage
from l... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/react/prompts.py | llama-index-core/llama_index/core/agent/react/prompts.py | """Default prompt for ReAct agent."""
from pathlib import Path
# TODO: have formatting instructions be a part of react output parser
with (
Path(__file__).parents[0] / Path("templates") / Path("system_header_template.md")
).open("r") as f:
__BASE_REACT_CHAT_SYSTEM_HEADER = f.read()
REACT_CHAT_SYSTEM_HEADER =... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/react/output_parser.py | llama-index-core/llama_index/core/agent/react/output_parser.py | """ReAct output parser."""
import re
from typing import Tuple
from llama_index.core.agent.react.types import (
ActionReasoningStep,
BaseReasoningStep,
ResponseReasoningStep,
)
from llama_index.core.output_parsers.utils import extract_json_str
from llama_index.core.types import BaseOutputParser
def extra... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/react/formatter.py | llama-index-core/llama_index/core/agent/react/formatter.py | # ReAct agent formatter
import logging
from abc import abstractmethod
from typing import List, Optional, Sequence
from llama_index.core.agent.react.prompts import (
CONTEXT_REACT_CHAT_SYSTEM_HEADER,
REACT_CHAT_SYSTEM_HEADER,
)
from llama_index.core.agent.react.types import (
BaseReasoningStep,
Observa... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/react/__init__.py | llama-index-core/llama_index/core/agent/react/__init__.py | from llama_index.core.agent.react.formatter import ReActChatFormatter
from llama_index.core.agent.react.output_parser import ReActOutputParser
__all__ = ["ReActChatFormatter", "ReActOutputParser"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/agent/react/types.py | llama-index-core/llama_index/core/agent/react/types.py | """Base types for ReAct agent."""
from abc import abstractmethod
from typing import Dict
from llama_index.core.bridge.pydantic import BaseModel
class BaseReasoningStep(BaseModel):
"""Reasoning step."""
@abstractmethod
def get_content(self) -> str:
"""Get content."""
@property
@abstract... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/base_handler.py | llama-index-core/llama_index/core/instrumentation/base_handler.py | from llama_index_instrumentation.base import BaseInstrumentationHandler # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/__init__.py | llama-index-core/llama_index/core/instrumentation/__init__.py | from llama_index_instrumentation import (
DispatcherSpanMixin, # noqa
get_dispatcher, # noqa
root_dispatcher, # noqa
root_manager, # noqa
)
from llama_index_instrumentation.dispatcher import (
DISPATCHER_SPAN_DECORATED_ATTR, # noqa
Dispatcher, # noqa
Manager, # noqa
)
from llama_index... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/dispatcher.py | llama-index-core/llama_index/core/instrumentation/dispatcher.py | from llama_index_instrumentation.dispatcher import (
DISPATCHER_SPAN_DECORATED_ATTR, # noqa
Dispatcher, # noqa
EventDispatcher, # noqa
Manager, # noqa
active_instrument_tags, # noqa
instrument_tags, # noqa
)
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py | llama-index-core/llama_index/core/instrumentation/span_handlers/simple.py | from llama_index_instrumentation.span_handlers.simple import SimpleSpanHandler # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span_handlers/__init__.py | llama-index-core/llama_index/core/instrumentation/span_handlers/__init__.py | from llama_index_instrumentation.span_handlers.base import BaseSpanHandler
from llama_index_instrumentation.span_handlers.null import NullSpanHandler
from llama_index_instrumentation.span_handlers.simple import SimpleSpanHandler
__all__ = [
"BaseSpanHandler",
"NullSpanHandler",
"SimpleSpanHandler",
]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span_handlers/null.py | llama-index-core/llama_index/core/instrumentation/span_handlers/null.py | from llama_index_instrumentation.span_handlers.null import NullSpanHandler # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span_handlers/base.py | llama-index-core/llama_index/core/instrumentation/span_handlers/base.py | from llama_index_instrumentation.span_handlers.base import BaseSpanHandler, T # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span/simple.py | llama-index-core/llama_index/core/instrumentation/span/simple.py | from llama_index_instrumentation.span.simple import SimpleSpan # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span/__init__.py | llama-index-core/llama_index/core/instrumentation/span/__init__.py | from llama_index_instrumentation.span import active_span_id
from llama_index_instrumentation.span.base import BaseSpan
from llama_index_instrumentation.span.simple import SimpleSpan
__all__ = ["BaseSpan", "SimpleSpan", "active_span_id"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/span/base.py | llama-index-core/llama_index/core/instrumentation/span/base.py | from llama_index_instrumentation.span.base import BaseSpan # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/span.py | llama-index-core/llama_index/core/instrumentation/events/span.py | from llama_index_instrumentation.events.span import SpanDropEvent # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/exception.py | llama-index-core/llama_index/core/instrumentation/events/exception.py | from llama_index.core.instrumentation.events import BaseEvent
class ExceptionEvent(BaseEvent):
"""
ExceptionEvent.
Args:
exception (BaseException): exception.
"""
exception: BaseException
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "Excepti... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/synthesis.py | llama-index-core/llama_index/core/instrumentation/events/synthesis.py | from typing import List
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.base.response.schema import RESPONSE_TYPE
from llama_index.core.schema import QueryType
class SynthesizeStartEvent(BaseEvent):
"""
SynthesizeStartEvent.
Args:
query (QueryType): Query... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/query.py | llama-index-core/llama_index/core/instrumentation/events/query.py | from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.base.response.schema import RESPONSE_TYPE
from llama_index.core.schema import QueryType
class QueryStartEvent(BaseEvent):
"""
QueryStartEvent.
Args:
query (QueryType): Query as a string or query bundle.
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/chat_engine.py | llama-index-core/llama_index/core/instrumentation/events/chat_engine.py | from llama_index.core.instrumentation.events.base import BaseEvent
class StreamChatStartEvent(BaseEvent):
"""
StreamChatStartEvent.
Fired at the start of writing to the stream chat-engine queue.
"""
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "StreamChat... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/llm.py | llama-index-core/llama_index/core/instrumentation/events/llm.py | from typing import Any, Dict, List, Optional
from llama_index.core.bridge.pydantic import BaseModel, SerializeAsAny, ConfigDict
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
CompletionResponse,
)
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/retrieval.py | llama-index-core/llama_index/core/instrumentation/events/retrieval.py | from typing import List
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.schema import QueryType, NodeWithScore
class RetrievalStartEvent(BaseEvent):
"""
RetrievalStartEvent.
Args:
str_or_query_bundle (QueryType): Query bundle.
"""
str_or_query_bu... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/rerank.py | llama-index-core/llama_index/core/instrumentation/events/rerank.py | from typing import List, Optional
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.schema import NodeWithScore, QueryType
from llama_index.core.bridge.pydantic import ConfigDict
class ReRankStartEvent(BaseEvent):
"""
ReRankStartEvent.
Args:
query (QueryTyp... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/__init__.py | llama-index-core/llama_index/core/instrumentation/events/__init__.py | from llama_index.core.instrumentation.events.base import BaseEvent
__all__ = [
"BaseEvent",
]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/embedding.py | llama-index-core/llama_index/core/instrumentation/events/embedding.py | from typing import Dict, List
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.bridge.pydantic import ConfigDict
class EmbeddingStartEvent(BaseEvent):
"""
EmbeddingStartEvent.
Args:
model_dict (dict): Model dictionary containing details about the embedding... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/base.py | llama-index-core/llama_index/core/instrumentation/events/base.py | from llama_index_instrumentation.base import BaseEvent # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/events/agent.py | llama-index-core/llama_index/core/instrumentation/events/agent.py | from typing import Any, Optional
from llama_index.core.bridge.pydantic import model_validator, field_validator
from llama_index.core.instrumentation.events.base import BaseEvent
from llama_index.core.chat_engine.types import (
AGENT_CHAT_RESPONSE_TYPE,
AgentChatResponse,
StreamingAgentChatResponse,
)
from ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/event_handlers/__init__.py | llama-index-core/llama_index/core/instrumentation/event_handlers/__init__.py | from llama_index_instrumentation.event_handlers.base import BaseEventHandler
from llama_index_instrumentation.event_handlers.null import NullEventHandler
__all__ = ["BaseEventHandler", "NullEventHandler"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/event_handlers/null.py | llama-index-core/llama_index/core/instrumentation/event_handlers/null.py | from llama_index_instrumentation.event_handlers.null import NullEventHandler # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/instrumentation/event_handlers/base.py | llama-index-core/llama_index/core/instrumentation/event_handlers/base.py | from llama_index_instrumentation.event_handlers.base import BaseEventHandler # noqa
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/table_node_mapping.py | llama-index-core/llama_index/core/objects/table_node_mapping.py | """Table node mapping."""
import uuid
from typing import Any, Dict, Optional, Sequence
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import Ba... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/base_node_mapping.py | llama-index-core/llama_index/core/objects/base_node_mapping.py | """Base object types."""
import os
import pickle
from abc import abstractmethod
from typing import Any, Dict, Generic, Optional, Sequence, TypeVar
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.storage.storage_context import DEFAULT_PERSIST_DIR
from llama_index.core.utils i... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/tool_node_mapping.py | llama-index-core/llama_index/core/objects/tool_node_mapping.py | """Tool mapping."""
from typing import Any, Dict, Optional, Sequence
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import BaseNode, TextNode
from llama_index.core.tools.query_engine import QueryEng... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/utils.py | llama-index-core/llama_index/core/objects/utils.py | from typing import Any, Callable, Optional, Sequence
from llama_index.core.tools import BaseTool
from llama_index.core.objects.base import SimpleObjectNodeMapping
from llama_index.core.objects.base_node_mapping import BaseObjectNodeMapping
from llama_index.core.objects.fn_node_mapping import FnNodeMapping
from llama_i... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/__init__.py | llama-index-core/llama_index/core/objects/__init__.py | """LlamaIndex objects."""
from llama_index.core.objects.base import ObjectIndex, ObjectRetriever
from llama_index.core.objects.base_node_mapping import SimpleObjectNodeMapping
from llama_index.core.objects.table_node_mapping import (
SQLTableNodeMapping,
SQLTableSchema,
)
from llama_index.core.objects.tool_nod... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/base.py | llama-index-core/llama_index/core/objects/base.py | """Base object types."""
import pickle
import warnings
from typing import Any, Callable, Generic, List, Optional, Sequence, Type, TypeVar
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.indices.base import BaseIndex
from llama_index.core.indices.vector_store.base import VectorStor... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/objects/fn_node_mapping.py | llama-index-core/llama_index/core/objects/fn_node_mapping.py | """Table node mapping."""
from typing import Any, Callable, Dict, Sequence
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import BaseNode
class FnNodeMapping(BaseObjectNodeMapping[Any]):
"""Fn... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/integration.py | llama-index-core/llama_index/core/download/integration.py | """Download pypi package."""
import importlib
import subprocess
import sys
from typing import Any
def pip_install(package: str) -> None:
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
def download_integration(module_str: str, module_import_str: str, cls_name: str) -> Any:
"""Retur... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/module.py | llama-index-core/llama_index/core/download/module.py | """Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from llama_index.core.download.utils import (
get_exports,
get_file_content,
initi... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/pack.py | llama-index-core/llama_index/core/download/pack.py | """Download llama-pack as template."""
import logging
import os
import subprocess
import sys
from importlib import util
from pathlib import Path
from typing import Any, Optional, Union
import requests
from llama_index.core.download.utils import (
ChangeDirectory,
get_file_content,
initialize_directory,
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/dataset.py | llama-index-core/llama_index/core/download/dataset.py | """Download."""
import json
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import tqdm
from llama_index.core.download.utils import (
get_file_content,
get_file_content_bytes,
get_source_files_list,
initialize_directory,
)
LLAMA_INDEX_CONTENTS_URL = (
f"http... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/utils.py | llama-index-core/llama_index/core/download/utils.py | import os
from pathlib import Path
from typing import List, Optional, Tuple
import requests
def get_file_content(url: str, path: str) -> Tuple[str, int]:
"""Get the content of a file from the GitHub REST API."""
resp = requests.get(url + path, timeout=(60, 60))
return resp.text, resp.status_code
def ge... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/download/__init__.py | llama-index-core/llama_index/core/download/__init__.py | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false | |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/playground/__init__.py | llama-index-core/llama_index/core/playground/__init__.py | """Init file of Playground."""
# playground
from llama_index.core.playground.base import (
DEFAULT_INDEX_CLASSES,
DEFAULT_MODES,
Playground,
)
__all__ = ["Playground", "DEFAULT_INDEX_CLASSES", "DEFAULT_MODES"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/playground/base.py | llama-index-core/llama_index/core/playground/base.py | """Experiment with different indices, models, and more."""
from __future__ import annotations
import time
from typing import Any, Dict, List, Type
from llama_index.core.callbacks import CallbackManager, TokenCountingHandler
from llama_index.core.indices.base import BaseIndex
from llama_index.core.indices.list.base i... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/streaming.py | llama-index-core/llama_index/core/langchain_helpers/streaming.py | import time
from queue import Queue
from threading import Event
from typing import Any, Generator, List, Optional
from uuid import UUID
from llama_index.core.bridge.langchain import BaseCallbackHandler, LLMResult
class StreamingGeneratorCallbackHandler(BaseCallbackHandler):
"""Streaming callback handler."""
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/text_splitter.py | llama-index-core/llama_index/core/langchain_helpers/text_splitter.py | # backward compatibility
from llama_index.core.text_splitter import *
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/__init__.py | llama-index-core/llama_index/core/langchain_helpers/__init__.py | """Init file for langchain helpers."""
try:
import langchain # noqa # pants: no-infer-dep
except ImportError:
raise ImportError(
"langchain not installed. "
"Please install langchain with `pip install llama_index[langchain]`."
)
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/memory_wrapper.py | llama-index-core/llama_index/core/langchain_helpers/memory_wrapper.py | """Langchain memory wrapper (for LlamaIndex)."""
from typing import Any, Dict, List, Optional
from llama_index.core.bridge.langchain import (
AIMessage,
BaseChatMemory,
BaseMessage,
HumanMessage,
)
from llama_index.core.bridge.langchain import BaseMemory as Memory
from llama_index.core.bridge.pydantic... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/agents/tools.py | llama-index-core/llama_index/core/langchain_helpers/agents/tools.py | """LlamaIndex Tool classes."""
from typing import Any, Dict, List
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.base.response.schema import RESPONSE_TYPE
from llama_index.core.bridge.langchain import BaseTool
from llama_index.core.bridge.pydantic import BaseModel, ConfigDic... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/agents/__init__.py | llama-index-core/llama_index/core/langchain_helpers/agents/__init__.py | """Llama integration with Langchain agents."""
from llama_index.core.langchain_helpers.agents.agents import (
create_llama_agent,
create_llama_chat_agent,
)
from llama_index.core.langchain_helpers.agents.toolkits import LlamaToolkit
from llama_index.core.langchain_helpers.agents.tools import (
IndexToolCon... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/agents/toolkits.py | llama-index-core/llama_index/core/langchain_helpers/agents/toolkits.py | """LlamaIndex toolkit."""
from typing import List
from llama_index.core.bridge.langchain import BaseTool, BaseToolkit
from llama_index.core.bridge.pydantic import ConfigDict, Field
from llama_index.core.langchain_helpers.agents.tools import (
IndexToolConfig,
LlamaIndexTool,
)
class LlamaToolkit(BaseToolkit... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/langchain_helpers/agents/agents.py | llama-index-core/llama_index/core/langchain_helpers/agents/agents.py | """Create LlamaIndex agents."""
from typing import Any, Optional
from llama_index.core.bridge.langchain import (
AgentExecutor,
AgentType,
BaseCallbackManager,
BaseLLM,
initialize_agent,
)
from llama_index.core.langchain_helpers.agents.toolkits import LlamaToolkit
def create_llama_agent(
too... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/service_context_elements/llama_logger.py | llama-index-core/llama_index/core/service_context_elements/llama_logger.py | """Logger class."""
from typing import Any, Dict, List, Set
class LlamaLogger:
"""Logger class."""
def __init__(self) -> None:
"""Init params."""
self._logs: List[Dict] = []
self._metadata: Dict[str, Any] = {}
def reset(self) -> None:
"""Reset logs."""
self._logs... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/service_context_elements/llm_predictor.py | llama-index-core/llama_index/core/service_context_elements/llm_predictor.py | """Wrapper functions around an LLM chain."""
import logging
from abc import ABC, abstractmethod
from typing import Any, Dict
from llama_index.core.base.llms.types import LLMMetadata
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.instrumentation import DispatcherSpanMixin
from llama_... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/service_context_elements/__init__.py | llama-index-core/llama_index/core/service_context_elements/__init__.py | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false | |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/table.py | llama-index-core/llama_index/core/data_structs/table.py | """Struct store schema."""
from dataclasses import dataclass, field
from typing import Any, Dict
from dataclasses_json import DataClassJsonMixin
from llama_index.core.data_structs.data_structs import IndexStruct
from llama_index.core.data_structs.struct_type import IndexStructType
@dataclass
class StructDatapoint(D... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/registry.py | llama-index-core/llama_index/core/data_structs/registry.py | """Index registry."""
from typing import Dict, Type
from llama_index.core.data_structs.data_structs import (
KG,
EmptyIndexStruct,
IndexDict,
IndexGraph,
IndexList,
IndexLPG,
IndexStruct,
KeywordTable,
MultiModelIndexDict,
)
from llama_index.core.data_structs.document_summary impor... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/struct_type.py | llama-index-core/llama_index/core/data_structs/struct_type.py | """IndexStructType class."""
from enum import Enum
class IndexStructType(str, Enum):
"""
Index struct type. Identifier for a "type" of index.
Attributes:
TREE ("tree"): Tree index. See :ref:`Ref-Indices-Tree` for tree indices.
LIST ("list"): Summary index. See :ref:`Ref-Indices-List` for... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/data_structs.py | llama-index-core/llama_index/core/data_structs/data_structs.py | """
Data structures.
Nodes are decoupled from the indices.
"""
import uuid
from abc import abstractmethod
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Sequence, Set
from dataclasses_json import DataClassJsonMixin
from llama_index.core.data_structs.struct_type import IndexStructT... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/__init__.py | llama-index-core/llama_index/core/data_structs/__init__.py | """Init file."""
from llama_index.core.data_structs.data_structs import (
IndexDict,
IndexGraph,
IndexList,
IndexLPG,
KeywordTable,
Node,
)
from llama_index.core.data_structs.table import StructDatapoint
__all__ = [
"IndexGraph",
"KeywordTable",
"IndexList",
"IndexLPG",
"In... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/data_structs/document_summary.py | llama-index-core/llama_index/core/data_structs/document_summary.py | """Data struct for document summary index."""
from dataclasses import dataclass, field
from typing import Dict, List
from llama_index.core.data_structs.data_structs import IndexStruct
from llama_index.core.data_structs.struct_type import IndexStructType
from llama_index.core.schema import BaseNode
@dataclass
class ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/eval_llm.py | eval_llm.py | import argparse
import random
import warnings
import numpy as np
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
from model.model_minimind import MiniMindConfig, MiniMindForCausalLM
from model.model_lora import *
from trainer.trainer_utils import setup_seed, get_model_params
warn... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/scripts/chat_openai_api.py | scripts/chat_openai_api.py | from openai import OpenAI
client = OpenAI(
api_key="ollama",
base_url="http://127.0.0.1:8998/v1"
)
stream = True
conversation_history_origin = []
conversation_history = conversation_history_origin.copy()
history_messages_num = 0 # 必须设置为偶数(Q+A),为0则不携带历史对话
while True:
query = input('[Q]: ')
conversation... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/scripts/serve_openai_api.py | scripts/serve_openai_api.py | import argparse
import json
import os
import sys
__package__ = "scripts"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import time
import torch
import warnings
import uvicorn
from threading import Thread
from queue import Queue
from fastapi import FastAPI, HTTPException
from fastapi.... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/scripts/convert_model.py | scripts/convert_model.py | import os
import sys
import json
__package__ = "scripts"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import torch
import warnings
from transformers import AutoTokenizer, AutoModelForCausalLM, LlamaConfig, LlamaForCausalLM
from model.model_minimind import MiniMindConfig, MiniMindForC... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/scripts/web_demo.py | scripts/web_demo.py | import random
import re
from threading import Thread
import torch
import numpy as np
import streamlit as st
st.set_page_config(page_title="MiniMind", initial_sidebar_state="collapsed")
st.markdown("""
<style>
/* 添加操作按钮样式 */
.stButton button {
border-radius: 50% !important; /* 改为圆形 */... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/scripts/train_tokenizer.py | scripts/train_tokenizer.py | import random
import json
from tokenizers import (
decoders,
models,
pre_tokenizers,
trainers,
Tokenizer,
)
import os
random.seed(42)
def train_tokenizer():
# 读取JSONL文件并提取文本数据
def read_texts_from_jsonl(file_path):
with open(file_path, 'r', encoding='utf-8') as f:
for l... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/model/model_minimind.py | model/model_minimind.py | # 📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘
# MiniMind Config
# 📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘📘
from transformers import PretrainedConfig
class MiniMindC... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/model/model_lora.py | model/model_lora.py | import torch
from torch import optim, nn
# 定义Lora网络结构
class LoRA(nn.Module):
def __init__(self, in_features, out_features, rank):
super().__init__()
self.rank = rank # LoRA的秩(rank),控制低秩矩阵的大小
self.A = nn.Linear(in_features, rank, bias=False) # 低秩矩阵A
self.B = nn.Linear(rank, out_fe... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/model/__init__.py | model/__init__.py | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false | |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_ppo.py | trainer/train_ppo.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import re
import warnings
import torch
import torch.distributed as dist
import torch.nn.functional as F
from transformers import AutoTokenizer
from contextlib import nullcontext... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/trainer_utils.py | trainer/trainer_utils.py | """
训练工具函数集合
"""
import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import random
import math
import numpy as np
import torch
import torch.distributed as dist
from torch.utils.data import Sampler
from transformers import AutoTokenizer
from model.... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_grpo.py | trainer/train_grpo.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import re
import gc
import warnings
import torch
import torch.distributed as dist
from transformers import AutoTokenizer
from contextlib import nullcontext
from torch import opt... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_dpo.py | trainer/train_dpo.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.nn.functional as F
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim
from torch.n... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_distill_reason.py | trainer/train_distill_reason.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim, nn
from torch.nn.parallel import Distribute... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_distillation.py | trainer/train_distillation.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.nn.functional as F
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim
from torch.n... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_spo.py | trainer/train_spo.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import re
import gc
import warnings
import torch
import torch.distributed as dist
from transformers import AutoTokenizer
from contextlib import nullcontext
from torch import opt... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_lora.py | trainer/train_lora.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim, nn
from torch.nn.parallel import Distribute... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_full_sft.py | trainer/train_full_sft.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim, nn
from torch.nn.parallel import Distribute... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/trainer/train_pretrain.py | trainer/train_pretrain.py | import os
import sys
__package__ = "trainer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import argparse
import time
import warnings
import torch
import torch.distributed as dist
from contextlib import nullcontext
from torch import optim, nn
from torch.nn.parallel import Distribute... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/dataset/lm_dataset.py | dataset/lm_dataset.py | import json
import pandas as pd
import numpy as np
from torch.utils.data import Dataset, DataLoader
import torch
import os
from datasets import load_dataset
os.environ["TOKENIZERS_PARALLELISM"] = "false"
class PretrainDataset(Dataset):
def __init__(self, data_path, tokenizer, max_length=512):
super().__i... | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false |
jingyaogong/minimind | https://github.com/jingyaogong/minimind/blob/a8455ca8a3ba44a04ba58e15b075a2a963d72231/dataset/__init__.py | dataset/__init__.py | python | Apache-2.0 | a8455ca8a3ba44a04ba58e15b075a2a963d72231 | 2026-01-04T14:41:50.216269Z | false | |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/dev-tools/i18n/convert_ts_txt.py | dev-tools/i18n/convert_ts_txt.py | import xml.etree.ElementTree as ET
import sys
inFile = sys.argv[1]
outFile = inFile[:-2] + "txt"
# 加载XML文件
tree = ET.parse(inFile)
# 获取根元素
root = tree.getroot()
# 遍历页面
data = []
count = 0
for page in root:
for message in page:
if message.tag == "name":
data.append([])
else:
... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/dev-tools/i18n/lrelease_all.py | dev-tools/i18n/lrelease_all.py | # 将所有翻译文件转为二进制
import os
ts_files = []
for root, dirs, files in os.walk("release"):
for file in files:
if file.endswith(".ts"):
ts_files.append(file)
print(ts_files)
for t in ts_files:
cmd = f'''lrelease.exe \
"release/{t}"'''
os.system(cmd)
| python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/dev-tools/i18n/plugins_tr.py | dev-tools/i18n/plugins_tr.py | import re
import csv
import sys
inFile = sys.argv[1]
outFile = "待翻译.csv"
def extract_strings_from_file(file_path):
pattern = r'tr\(["\']([^"\']*)["\']\)' # 正则表达式模式
strings = []
with open(file_path, "r", encoding="utf-8") as file:
content = file.read()
matches = re.findall(pattern, conte... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/dev-tools/i18n/convert_txt_ts.py | dev-tools/i18n/convert_txt_ts.py | import xml.etree.ElementTree as ET
import sys
inFile = sys.argv[1]
outFile = inFile + ".ts"
sourceFile = inFile[:-3] + "ts"
tree = ET.parse(sourceFile)
txt = open(inFile, encoding="utf-8").read()
txt = txt.split("\n")
tranIndex = 0
root = tree.getroot()
for page in root:
for message in page:
if message.... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/dev-tools/i18n/lupdate_all.py | dev-tools/i18n/lupdate_all.py | # 刷新所有翻译文本文件 .ts
# git push 后,在线编辑:
# https://hosted.weblate.org/projects/umi-ocr/ui/
import os
import sys
import xml.etree.ElementTree as ET
LangList = [
"en_US", # 英语(美国) | English
"zh_TW", # 中文(繁体) | 繁體中文
"ja_JP", # 日语 | 日本語
"fr_FR", # 法语 | Français
"pt", # 葡萄牙语 | Português
"ru_RU", #... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/UmiOCR-data/main.py | UmiOCR-data/main.py | # Umi-OCR
# OCR software, free and offline. 开源、免费的离线OCR软件。
# Website - https://github.com/hiroi-sora/Umi-OCR
# Author - hiroi-sora
#
# You are free to use, modify, and distribute Umi-OCR, but it must include
# the original author's copyright statement and the following license statement.
# 您可以免费地使用、修改和分发 Umi-OCR ,但必须包含... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/UmiOCR-data/py_src/run.py | UmiOCR-data/py_src/run.py | # Umi-OCR
# OCR software, free and offline. 开源、免费的离线OCR软件。
# Website - https://github.com/hiroi-sora/Umi-OCR
# Author - hiroi-sora
#
# You are free to use, modify, and distribute Umi-OCR, but it must include
# the original author's copyright statement and the following license statement.
# 您可以免费地使用、修改和分发 Umi-OCR ,但必须包含... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
hiroi-sora/Umi-OCR | https://github.com/hiroi-sora/Umi-OCR/blob/83173efc4f4453b41223ea96d63d44534bf0505c/UmiOCR-data/py_src/tag_pages/tag_pages_connector.py | UmiOCR-data/py_src/tag_pages/tag_pages_connector.py | # ===========================================================================
# =============== 【前端qml标签页】与【后端Python控制器】的连接器 ===============
# ===========================================================================
"""
每一个qml页面,都可以拥有一个对应的Python控制器实例。
前端页面访问各种后端功能,必须靠这个控制器作为中转。
"""
from PySide2.QtCore import QObje... | python | MIT | 83173efc4f4453b41223ea96d63d44534bf0505c | 2026-01-04T14:40:28.794697Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.