-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
191 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye | ||
|
||
RUN curl -fsSL https://ollama.com/install.sh | sh\ | ||
&& pip install uv\ | ||
RUN pip install uv\ | ||
&& uv venv /workspaces/.venv\ | ||
&& export UV_PROJECT_ENVIRONMENT=/workspaces/.venv\ | ||
&& echo export UV_PROJECT_ENVIRONMENT=/workspaces/.venv >> /root/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ghcr.io/ggerganov/llama.cpp:server | ||
|
||
# Install curl and other necessary utilities | ||
RUN apt-get update && \ | ||
apt-get install -y curl && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
curl -L https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q8_0.gguf --output Llama-3.2.gguf | ||
|
||
CMD ["-m", "Llama-3.2.gguf", "--port", "8000"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Pytest | ||
name: Pytest (Installation) | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
@@ -40,12 +40,8 @@ jobs: | |
python -m pip install uv | ||
uv sync --extra test --extra chat | ||
- name: Test with pytest | ||
env: # Or as an environment variable | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
REDIS_OM_URL: ${{ secrets.REDIS_OM_URL }} | ||
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} | ||
run: | | ||
uv run pytest --cov=. --cov-report=xml | ||
uv run pytest tests/cli --cov=. --cov-report=xml | ||
- name: Upload coverage report to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Pytest in docker | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release | ||
- dev | ||
pull_request: | ||
branches: | ||
- main | ||
- release | ||
|
||
jobs: | ||
Pytest: | ||
strategy: | ||
max-parallel: 5 | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker | ||
if: runner.os == 'ubuntu-latest' | ||
uses: docker-practice/actions-setup-docker@master | ||
timeout-minutes: 12 | ||
- name: Docker compose up | ||
run: | | ||
docker-compose -f .devcontainer/docker-compose.yml up -d | ||
- name: Test with pytest | ||
run: | | ||
docker compose -f .devcontainer/docker-compose.yml run --rm -u root -v ./:/workspaces/sotopia devcontainer /bin/sh -c "export UV_PROJECT_ENVIRONMENT=/workspaces/.venv; cd /workspaces/sotopia; uv run --extra test --extra chat pytest --ignore tests/cli --cov=app --cov-report=xml" | ||
- name: Upload coverage report to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from pydantic import BaseModel | ||
from openai import OpenAI | ||
|
||
# client = OpenAI(base_url="http://localhost:8000/v1", api_key="") | ||
|
||
|
||
class CalendarEvent(BaseModel): | ||
name: str | ||
date: str | ||
participants: list[str] | ||
|
||
|
||
# completion = client.beta.chat.completions.parse( | ||
# model="llama3.2:1b", | ||
# messages=[ | ||
# {"role": "system", "content": "Extract the event information."}, | ||
# {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}, | ||
# ], | ||
# # response_format=CalendarEvent, | ||
# ) | ||
|
||
# event = completion.choices[0].message.parsed | ||
|
||
client = OpenAI( | ||
base_url="http://localhost:8000/v1", | ||
api_key="ollama", # required, but unused | ||
) | ||
|
||
response = client.beta.chat.completions.parse( | ||
model="llama3.2:1b", | ||
messages=[ | ||
{"role": "system", "content": "You are a helpful assistant."}, | ||
{"role": "user", "content": "Who won the world series in 2020?"}, | ||
{"role": "assistant", "content": "The LA Dodgers won in 2020."}, | ||
{"role": "user", "content": "Where was it played?"}, | ||
], | ||
response_format=CalendarEvent, | ||
) | ||
print(response.choices[0].message.parsed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.